最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - 404 error. Too long Ajax url - Stack Overflow

programmeradmin2浏览0评论

I am sending form data using Ajax

function sendData(){

    var formData = $('form').serialize();

    $.ajax({
        url:'/../admin/ajaxUtility.cfc?method=saveFormData',
        data: formData
    }); 
};

Above function works fine but sometimes I am sending huge data which makes url too long.

I am getting '404 Not Found' error with 'XML Parsing Error: no element found Location: moz-nullprincipal:{25f2f525-....} Line Number 1, Column 1:' in console window.

Is their any alternate way to send data using Ajax?

Thank you in advance for your help.

I am sending form data using Ajax

function sendData(){

    var formData = $('form').serialize();

    $.ajax({
        url:'/../admin/ajaxUtility.cfc?method=saveFormData',
        data: formData
    }); 
};

Above function works fine but sometimes I am sending huge data which makes url too long.

I am getting '404 Not Found' error with 'XML Parsing Error: no element found Location: moz-nullprincipal:{25f2f525-....} Line Number 1, Column 1:' in console window.

Is their any alternate way to send data using Ajax?

Thank you in advance for your help.

Share Improve this question asked Sep 9, 2013 at 22:04 Vikrant ShitoleVikrant Shitole 51410 silver badges19 bronze badges 4
  • 2 Try using POST and putting the data in the body, instead of using a GET and appending everything to the URL – Chad Commented Sep 9, 2013 at 22:05
  • 3 Can you not send it as POST instead of GET? – user2625787 Commented Sep 9, 2013 at 22:05
  • 1 Add type:'POST' to your AJAX options and update your server side code to use POST data instead of GET – user1864610 Commented Sep 9, 2013 at 22:06
  • Thank you all for input. Yes, POST type was missing. – Vikrant Shitole Commented Sep 9, 2013 at 22:20
Add a ment  | 

2 Answers 2

Reset to default 7
function sendData(){

    var formData = $('form').serialize();

    $.ajax({
        type : "POST",   // TRIED THIS ONE ?
        url : '/../admin/ajaxUtility.cfc?method=saveFormData',
        data : formData
    }); 

} // ';' not needed at this point

Docs: http://api.jquery./jQuery.ajax/#entry-examples

I have added POST type and it works fine.

function sendData(){

    var formData = $('form').serialize();

    $.ajax({
        url:'/../admin/ajaxUtility.cfc?method=saveFormData',
        type: "POST",
        async: true,
        data: formData
    }); 
};
发布评论

评论列表(0)

  1. 暂无评论