javascript - Run jquery ajax with multi diemnstion array without form -
I am trying to scrape some element data from a page using jquery and save the database in php file I am sending what I am doing:
- I am creating a two-dimensional array and want to pass the data to the php file so that I can run a foreach load to save in the database :
Error: Receiving Message Now: Syntax Error: In the Warning Box Unexpected token A is the warning (errorThrown);
My jquery code is:
function scraps () {var Info = new array (); $ ("Div.clip"). Each (function (index) = {}; info [index] ['name'] = $ (this) .find (".fn"). Text (); Info [index] ['rating' ] = $ (This) .find ("span.tinypush"). Text (); info [index] ['review'] = $ (this) .find ("p.description") .text ();}) ; Console.log (info); $ AZ ({type: "post", url: "save_scrap.php", data: {info: info}, datatype: "jason", preceded: function () {// something before sending the request to server} Error: Function (jqXHR, textstatus, error log);}, success: function (data) {console.log (data); $ ("# div1") .html (data); alerts ('success!') ;}}); return false; }
and I'm trying to get it into the php file:
print_r ($ _ POST);
Please tell me in the comments if you think the question is not good or not understood well.
Thank you.
var info = new array ();
should be
var info = [];
and it should also be outside of .each
.
Comments
Post a Comment