开发者

How do I capture the post parameters from a server file using ajax in jquery?

I have datestring ="name=one"

$.ajax({  
                type: "POST", url: 'url.com', data:datastring,  
             开发者_如何转开发   complete: function(data){  
                    alert(data);  
                }  ,

        success:function() { alert("success"); },

})
    });

I use ajax to send the datastring to url.com. However url.com redirects the page to the initial one together with some post parameters..How can I retrieve those parameters using ajax ?


You have an error in your code, because e forgot to put the semicolon ';':

$.ajax({  
    type: "POST",
    url: 'url.com',
    data:{
        name: 'one'
    },
    complete: function(data){  
        alert(data);  
    },
    success:function() {
        alert("success");
    },

});

Other think, it's about the data, the above example method it's better.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜