arrays - Safari Json.stringify error -


im getting error (only safari, chrome , firefox working) : syntaxerror: unexpected token '}'. expected ':' following property name 'params' on function:

  function buildprojecttypeselect(params){   var result;   $.ajax({     type: "post",     url: "include/builds/buildprojecttypeselect.php",     async: false,     contenttype: "application/json",     data: json.stringify({params}),     success: function(data) {        result = $.parsejson(data);     }   });  return result;  } 

something wrong json.stringify({params}).

params array =

[object { 0="2",  1="name1",  id_projecttype="2"},  object { 0="3",  1="name2",  id_projecttype="3"},  object { 0="4",  1="nam3",  id_projecttype="4"}] 

you don't need braces around params:

  function buildprojecttypeselect(params){   var result;   $.ajax({     type: "post",     url: "include/builds/buildprojecttypeselect.php",     async: false,     contenttype: "application/json",     data: json.stringify(params),     success: function(data) {        result = $.parsejson(data);     }   });  return result;  } 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -