var name = "gökhan";
var surname = "sahiner";
var id = 12;
$.ajax({
type: "POST",
url: "newlevels.php",
data: name,
success: success,
dataType: dataType
});
嗨,我想发表多篇文章,但我一直在各处搜索,我听不懂 只有我被发现这个。我该如何张贴。 3种
答案 0 :(得分:0)
有几种方法可以执行此操作。您可以创建一个对象并发布该对象,可以序列化表单(也是一个对象),也可以简单地用逗号分隔它。
def __eq__(self, other):
return self.data == other.data
RecursionError
答案 1 :(得分:0)
我完全同意@Timothy,这将起作用。您也可以在下面查看:-
var name = "gökhan";
var surname = "sahiner";
var id = 12;
var array = name+'|'+surname+'|'+id ; // Create an array with the variables and pass this array and on the other page just explode it to get the separate values
$.ajax({
type: "POST",
url: "newlevels.php",
data: array,
dataType: dataType,
success: function(){//Your function goes here}
});
答案 2 :(得分:0)
看看这个:-
$(document).ready(function(){
$("#button").click(function(){ //Expecting the event on a button click
var name = "gökhan";
var surname = "sahiner";
var id = 12;
var array = name+'|'+surname+'|'+id ;
var xmlhttp ;
if (window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","newlevels.php?array="+array,true);
xmlhttp.send();
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
var result = xmlhttp.responseText ;
if (result == 1){
//Your code for success return
}
else{
//Your code if return is not a success
}
}
}
});
});
希望这会起作用,如果有任何错误,请通知我。