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 data: hardwarepoload and it will work. If I do {hardware: hardware load, service: servicepoload} then I get very weird JSON output. Which looks 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 ..

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

I think if you do not, then you will be better < $ 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);}});

(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.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -