jquery 通用的表单(form)提交 input
加一個省事的回調
详细一点的
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* www.sofut.com mysite
* www.aixq.com blog
*/
function ajaxsend(actset,inputid,showmsg)
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在发送");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(showmsg)
{
if(json.msg)
{
alert(json.msg);
$("#msg").html(json.msg);
$("input[type=reset]").click();
}
else
{
alert(json.error);
}
}else
{
$("#msg").html(json.msg);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* www.sofut.com mysite
* www.aixq.com blog
*/
function ajaxsend(actset,inputid,showmsg)
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在建立链接..");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(json.msg)
{
if(showmsg)
{
alert(json.msg);
}
$("input[type=reset]").click();
$("#msg").html(json.msg);
if($("#loadbody").text()!="")
{
$("#loadbody").load(window.location.href+"?"+Math.random()+" #loadbody",function(){});
}
}
else
{
alert(json.error);
$("#msg").html(json.error);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
* www.sofut.com mysite
* www.aixq.com blog
*/
function ajaxsend(actset,inputid,showmsg)
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在建立链接..");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(json.msg)
{
if(showmsg)
{
alert(json.msg);
}
$("input[type=reset]").click();
$("#msg").html(json.msg);
if($("#loadbody").text()!="")
{
$("#loadbody").load(window.location.href+"?"+Math.random()+" #loadbody",function(){});
}
}
else
{
alert(json.error);
$("#msg").html(json.error);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
function ajaxsend(actset,inputid,showmsg)
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在发送");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(showmsg)
{
alert(json.msg);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在发送");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(showmsg)
{
alert(json.msg);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
详细一点的
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* www.sofut.com mysite
* www.aixq.com blog
*/
function ajaxsend(actset,inputid,showmsg)
{
$.ajax({
beforeSend:function(){
$("#msg").html("正在发送");
},
dataType:"json",
type: "post",
url:"ajax.php?act="+actset,
data: $("#"+inputid+" :input").serialize(),
success: function(json){
if(showmsg)
{
if(json.msg)
{
alert(json.msg);
$("#msg").html(json.msg);
$("input[type=reset]").click();
}
else
{
alert(json.error);
}
}else
{
$("#msg").html(json.msg);
}
},
error:function(){
$("#msg").html("链接出错");
}
});
}
京东的一个最新商品的跳的js
php的html过虑
