0

folks

we are facing a strange issue with jquery ( 1.8.3) and we are using cakePHP

enter image description here

as per the image

Our assumption is we are sending the data( about 500 +) with ajax call in POST method.

we are having this issue in all the major browsers.

enter image description here

as above( in chrome) , we are getting this error in console we passed 618 destinations in ajax call.

let us know the work around to solve this problem.

My ajax call is as below

function validate_test() {
        $("#btn1").empty();
        var ele = document.getElementById('frm_searchDateFrom').value;
        var ele2 = document.getElementById('frm_searchDateTo').value;
        var sub_url = '<?php echo $this->Html->url('/', true); ?>';
        var url = sub_url + "admin/reports/check_originator/" + ele +"/"+ ele2 +"/"+ $("#destination").val();
        alert(url);
        jQuery.ajax({
            type: "POST",
            datatype: "json",
            url: url,
            success: function(data)
            {
                var el = $("select#btn1").multiselect();
                var d;
                var results=data.split(",");
                for(d=0;d<results.length;d++) {
                var d;
                var v = results[d], opt = $('<option />', {
                    value: v,
                    text: v
                });
                opt.appendTo( el );
                el.multiselect('refresh');
                }
            }
        })
    }
4

1 回答 1

0

在您的 JQuery Ajax 方法中,而不是将所有这些详细信息作为 url 查询参数发送,方法是将这些详细信息包装在一个对象中。

function validate_test() {
        $("#btn1").empty();
        var ele = document.getElementById('frm_searchDateFrom').value;
        var ele2 = document.getElementById('frm_searchDateTo').value;
        var sub_url = '<?php echo $this->Html->url('/', true); ?>';
        var url = sub_url + "admin/reports/check_originator/";
        var formdata=ele +"/"+ ele2 +"/"+ $("#destination").val();//put form data's in an object 
        alert(url);
        jQuery.ajax({
            type: "POST",
            datatype: "json",
            data:formdata,//send the form data object in post 
            url: url,
            success: function(data)
            {
                var el = $("select#btn1").multiselect();
                var d;
                var results=data.split(",");
                for(d=0;d<results.length;d++) {
                var d;
                var v = results[d], opt = $('<option />', {
                    value: v,
                    text: v
                });
                opt.appendTo( el );
                el.multiselect('refresh');
                }
            }
        })
    }

也参考这个小提琴(不是我的):http: //jsfiddle.net/clickthelink/Uwcuz/1/

于 2013-10-16T10:19:12.380 回答