English 中文(简体)
J Query Ajax and concatenatedstring
原标题:JQuery Ajax and concatenated string

I`m trying to do an Ajax Request but for some reason it wont accept my concatenated string. When the query should have some parameters it leaves them out and makes GET call.

这里是I've撰写的法典的一小部分。

        var queryString = "";
        var separator = "?";

        for (param in config.query) {
            queryString = queryString.concat(separator, param, "=", config.query[param]);
            separator = "&";
        }

        var url = config.url + queryString;

        $.ajax({
            url : url,
问题回答

The only reason I can think is that your QueryString is not properly encoded.
Try this

queryString = queryString.concat(separator, param, "=", encodeURIComponent(config.query[param]));

Try to see if the content inside url after this line var url = config.url + queryString; add alert(url); see if the content is what you need it to be

您可使用<条码>数据参数通过以下段落:

var queryString = "";
var separator = "";

for (param in config.query) {
    queryString = queryString.concat(separator, param, "=", config.query[param]);
    separator = "&";
}

$.ajax({
    url: config.url,
    data: queryString,
    ...
});




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签