admin管理员组

文章数量:1326112

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
    }); 
};

本文标签: javascript404 error Too long Ajax urlStack Overflow