POST a javascript objet to a PHP file

I try to post an JS object to PHP, but the PHP says nothing.. It looks like it don't recognize the POST... Here is the JS : $('.send').click(function() { var Scommand = JSON.stringify(command);// Command is my JS obj if (commande.type) { $.ajax({ url:'test.php', context:$(this), type:'POST', data:Scommande, success : function(data){ commande = {}; window.location='test.php'; } });//End Ajax } else {'PLz specify a type');} }); And my PHP : It returns : Notice: Undefined index: type in /Applications/MAMP/htdocs/BackOfficeDavid/test.php on line 2 Like nothing go throw the POST ... Any clue ?
data:{mydata: Scommand}, and look at $_POST['mydata']

以上就是POST a javascript objet to a PHP file的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏