展开全部
ajax的常用框架有两种,prototype.js/jquery.js,不知道你要哪一种,类似的方式如下:
pro
new Ajax.Request('/some_url',
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText || "no response text";
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
jquery
$.ajax({
type : 'GET',
dataType : 'json',
data : data,
url : '{# $update_url #}',
success : function (rtn) {
if ( rtn.status == 'error' ){
alert(_msgStr[rtn.msgno]);
} else if (rtn.status == 'success') {
alert(_msgStr[rtn.msgno]);
location.reload(true);
}
},
pro
new Ajax.Request('/some_url',
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText || "no response text";
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
jquery
$.ajax({
type : 'GET',
dataType : 'json',
data : data,
url : '{# $update_url #}',
success : function (rtn) {
if ( rtn.status == 'error' ){
alert(_msgStr[rtn.msgno]);
} else if (rtn.status == 'success') {
alert(_msgStr[rtn.msgno]);
location.reload(true);
}
},
展开全部
没看懂你说的意思 给你个我用过的方法 你试试 能不能解决你的问题
function del_comment()
{
if(c == '')
{
return;
}
ajax = createXMLHttpRequest();
ajax.open("GET","delcomment.php?key=" + c,true);
ajax.onreadystatechange = loadingName;
ajax.setRequestHeader("If-Modified-Since","0");
ajax.send(null);
}
看到那个 delcomment.php?key=" + c 你看是不是这个意思
function del_comment()
{
if(c == '')
{
return;
}
ajax = createXMLHttpRequest();
ajax.open("GET","delcomment.php?key=" + c,true);
ajax.onreadystatechange = loadingName;
ajax.setRequestHeader("If-Modified-Since","0");
ajax.send(null);
}
看到那个 delcomment.php?key=" + c 你看是不是这个意思
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询