Click here to Skip to main content
15,867,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
JavaScript
//More than 593 values it goes to error instead of success

function getZipCodeListDefault() {
var arrs=[];
    var index = 0;
    try {
        $.ajax({
            type: "POST",
            cache: false,
            async: false,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            url: "../WebMethods/WebMethod.aspx/getZipCodeListDefault",
            success: function (data) {
                if (data.d.length > 0) {
                    $.each(data.d, function (k, v) {
                        arrs[index] = v.ZipCode;
                        index++;
                    });
                }
                else {
                }
            },
            error: function (error) {
                alert(error);
            }
        });
    }
    catch (err) {
        alert("Catch " + err);
    }
    finally {
        alert("Finally");
    }
}
Posted
Updated 13-Nov-15 18:31pm
v2
Comments
Krunal Rohit 14-Nov-15 0:33am    
What's the use of $.ajax() when you set async to false ?

-KR

1 solution

Well, JSON has a default characters limit to 102400. See this[^].
But you can specify the limit in web.config
HTML
<system.web.extensions>
    <scripting>
        <webservices>
            <jsonserialization maxjsonlength="any-integer-value" />
        </webservices>
    </scripting>
</system.web.extensions>


Rather return the split-ed list and combine them on client-side.

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900