-1

I have a weird problem when sending parameters through an ajax call (jQuery1.4), but only with IE. I also tried it without jQuery, and wrote my own xmlhttp request, but I still get the same results.

When I send variables like this:

var1 = value1, var2 = value2, var3 = value3, var4 = value4

They are all passed to ajax query as a data property, and sent to the server. However, random parameters are missing in random places. For example, the PHP Server only receives:

var1 = value1, var3 = value3, var4 = value4

The passed values are URL encoded and contain normal short text strings. What could cause this kind of random skipping of variables?

4

1 回答 1

0

Why don't you use an object? This way you don't have to worry with encoding params.

$.ajax({
    url: 'your_url',
    type: 'post',
    data: {
        var1 : 'value1',
        var2 : 'value2',
        var3 : 'value3',
        var4 : 'value4'
    }, 
    success: function(result) {
        alert('result');
    }
);
于 2013-05-29T20:18:29.183 回答