I am trying to send a javascript object along with some form data using the short hand $.post().
我试图使用简写$ .post()发送一个javascript对象以及一些表单数据。
I am trying to combine the 2 together but having a hard time doing so. Also how would i be able to retrieve the form data in my php page?
我试图将2组合在一起,但很难这样做。我怎样才能在我的php页面中检索表单数据?
Any help would be really appreciated! Thanks!
任何帮助将非常感激!谢谢!
$("#copy_options").on("click", function(){
$.post("copyOptions.php",{menu_item_ids : item_ids} $("#optionsMenu").serialize(); )
.fail(function(){
// console.log("Ajax Failed");
})
.done(function () {
//console.log("Ajax has been complete");
});
});
1 个解决方案
#1
0
Try this
$("#copy_options").on("click", function(){
var dataObj={
serializeData:$("#optionsMenu").serialize(),
menu_item_ids :item_ids
}
$.post("copyOptions.php",dataObj )
.fail(function(){
// console.log("Ajax Failed");
})
.done(function () {
//console.log("Ajax has been complete");
});
});
#1
0
Try this
$("#copy_options").on("click", function(){
var dataObj={
serializeData:$("#optionsMenu").serialize(),
menu_item_ids :item_ids
}
$.post("copyOptions.php",dataObj )
.fail(function(){
// console.log("Ajax Failed");
})
.done(function () {
//console.log("Ajax has been complete");
});
});