0

I'm sending some variables to AJAX call with POST method to PHP file as below -

$.ajax({
type: "POST",
url:  "sendEmail.php",
data: {
       'v1':mailto,
       'v2':pname,
       'v3':ptype
},

Now in addition to this, I've some data as below - DataArray = {"name",value1, value2},{"name",value1, value2},{"name",value1, value2}.

How can I send above array (array of array objects) in above AJAX call. Also how can I get array in PHP file.

Any inputs will be helpful. Thanks!

Kishor
  • 23
  • 3
  • 7
  • `DataArray` doesn't look like any valid kind of JS data structure. Are you missing `[...]`? – Phil Aug 28 '17 at 04:50
  • This is a little too broad to answer properly. My advice would be to POST JSON data to your PHP script. See https://stackoverflow.com/a/23750707/283366 – Phil Aug 28 '17 at 04:54
  • @ Phil - yes, I'm missing exact syntax actually. – Kishor Aug 28 '17 at 05:14
  • Serialize the form data and send https://stackoverflow.com/a/15174312/7296317 Hope this link helps :) – Dinesh Kumar Aug 28 '17 at 11:56

0 Answers0