2

I had a server request to http://ixxxp/abc.action?param:{userId:1234} to get some information about the user. And I use jQuery Ajax to request this info.

When I test through curl or other browser client, I was curious about the param list. How can a server page receive this url request? Shouldn't it be like:

http:// ixxxp/abc.action?userId=1234 //-------------------------1

Or

http:// ixxxp/abc.action?param={userId:1234}//------------------2

But 1 returns {} which is definitely not true. 1234 is a test user, and he has some information predifined.

The final question is : How can I request this servlet in Ajax, because jQuery will generate a url like 1 which doesn't work in my situation

4

1 回答 1

1

关于您的第一个问题:应用程序必须具有某种读取机制来读取 URL (Query_String),然后将其分解为参数。

关于你的第二个问题,我想你可以这样做:

function getUser(userId){
    $.ajax({
        type: 'POST',
        url: 'abc.action?param={userId:'+userId+'}',
        data: {
        },
        beforeSend:function(){
        },
        success:function(data){
        },
        error:function(){
        }
    });
}
于 2013-07-16T11:41:21.840 回答