php - JS AJAX sending multiple data array -
I am trying to send multiple data arrays to my AJAX function.
I like each array individually like Hardware =% 5% B% 7% 22 Hardware Name% 22% 3A% 221% 22% 2C% 22 Hardware Volume 22% 3A% 22% 22% 2c% 22 hardware BIWOD% 22% 3A% 22% 22% 7D% 5D and service =% 5% b% 7% 22% Assurance% 22% 3A% 223% 22% 2C% 22Servicecentre I need two arrays to have a hardware and a service so that I can grab each one separately. My code looks like this .. I think if you do not, then you will be better < (Note that I am using not strong hardware model and serviceModel ) < / P> In this way you can handle the jQuery (JSN) data for the request. data: hardwarepoload and it will work. If I do
{hardware: hardware load, service: servicepoload} then I get very weird JSON output. Which looks like:
self.save = function (form) {var hardware model = []; Var servicemodel = []; Ko.utils.arrayForEach (self.services (), function (service) {serviceModel.push (ko.toJS (service));}); Ko.utils.arrayForEach (self.hardwares (), function (hardware) {hardwareModel.push (ko.toJS (hardware));}); //allModel.push ({accountId: ct.js (account)}; Var HardwarePlayload = JSON. Strings (Hardware Model); Var servicePayload = JSON.stringify (service model); //alert(JSON.stringify (service model) + JSON.stringify (allModel)); $ AJAX ({url: '/ command / add', type: 'post', data: {hardware: hardwarepoload, service: serviceproducts}, // data: hardwareloadload, content type: 'app / jason', success: function results) {Warning (result);}}); };
$ Ajax ({url: '/ orders / add', type: 'post', data: {hardware: hardware modell, service: service model}, // data: hardware load, content type: 'app / jason', success: function (Result) {warning (result);}});
Comments
Post a Comment