javascript - Getting error trying to submit data using JQuery ajax -


when try run following jquery ajax, error saying parameter missing , not send data. can't find syntax errors. doing wrong?

here javascript jquery ajax code:

function submitaction(actionname) {           if (actionname == "illustrationgenerate.htm") {          var thisform = document.getelementbyid("illustrationtypeform");         var fd = new formdata(thisform);         $.ajax({             url: "illustrationgenerate.htm",             type: "post",             data: fd,             datatype: "xml",             cache: false,             success: function (result, status, xhr) {                 document.getelementbyid('errormessage0').value="success";             },             error: function (xhr, status, error) {                 alert(xhr.status);                 alert(request.responsetext);             }                                    });      } else {         document.forms[0].action = actionname;         document.forms[0].method = "post";         document.forms[0].target = '';         document.forms[0].submit();     } } 

why not use jquery native form encoder?

 $.ajax({             ...             data: $('#illustrationtypeform').serializearray(),             ...          }); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -