I am trying to process a form via AJAX request. The problem is that I have an array variable inside the form and when I work through serialize to send it through AJAX, it gives it:
email_id% 5B% 5D = 1 & amp; Email_id% 5B% 5D = 2 & amp; Test = 23 This is the result. Sierialize
I am also using multiple selection tags for array variables.
Why am I getting this error and what should I do to avoid and correct it? "name_id []" id = "email_id_0" id = "email_id_0" style = "width: 350px; margin-right: 5;" & gt; & Lt; / Select & gt; Function Set List (str) {var postDatas = $ ('# form' + str + '') Serialize (); Warnings (postDatas); // $ ('# crm-feedback'). Html ('& lt; img src = "images / ajax-loader.gif" />'); $ .ajax ({url: 'somewhere / file.php', type: 'post', data: postdates, success: function (data) {// $ ('# crm-feedback'). Html ('saved! '). CSS (' color ',' green '); warning ("test");}}); } Thanks.
Try the following
var array = document.getElementById ( "& Lt; your array alm"); Var formidata = new form data (); (Var i = 0; i & lt; array.label; i ++) {formdata.append ("& lt; of & gt;", array [i]); } $ .AJX ({url: "& lt; url>", Data type: "& lt; expected return datatype", type: "POST", data: formdata, success: function (result, status) { // process success}, error: function (result, status) {// process failure}});
No comments:
Post a Comment