如何使用Ajax调用将参数发送到servlet [英] How to send parameter to a servlet using Ajax Call

查看:260
本文介绍了如何使用Ajax调用将参数发送到servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ExtJs应用程序中有一个控制器,从那里我必须对Servlet进行Ajax调用,并且还必须向该Servlet发送一些参数.我能够正确调用Servlet,但我得到的是空值.我认为我在发送参数时出错了....这是我的代码...

i have a controller in my ExtJs application ,from where i have to make an Ajax call to a servlet and also have to send some parameters to that servlet also.i am able to call the servlet properly but i am getting null values.i think i am making mistake in sending parameters.... this is my code ...

dataBaseCall: function(barData){
    Ext.Ajax.request({
        url: "CallRatiosAnalysis",
        method:'POST',
        param:{
            source:barData
        },
        success: function(response, opts){
            //do what you want with the response here
            console.log("hiiiiiiiiiiii");
        },
        failure: function(response, opts) {
            alert("server-side failure with status code " + response.status);
        }

    });
}

我必须将barData发送到CallRatiosAnalysis Servlet.但是我在CallRatiosAnalysis servlet中得到的是空值.请有人帮忙.

i have to send barData to the CallRatiosAnalysis servlet. but i am getting null values in the CallRatiosAnalysis servlet .somebody please help.

推荐答案

这是您的答案jeet ..它将正常工作...只需替换此行....

Here is your answer jeet.. It will work fine... Just replace this line....

url: "CallRatiosAnalysis?param="+source+"&param1="+count,

这篇关于如何使用Ajax调用将参数发送到servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆