jquery.form提交方式

var options = {
target : '#publishform',
url : base+'/forum/publish',
type : 'POST',
dataType: 'json',
success:function(data){
if(data.optflag==false)
{
alert(data.tips);
}
else
{
var platetype = $("#platetype").val();
if('0' == platetype)
{
window.location.href=base+"/forum/initSchoolStory?active=0";
}
else if ('1' == platetype)
{
window.location.href=base+"/forum/initFeel?active=1";
}
else{
window.location.href=base+"/forum/initFootprint?active=2";
}
}
}
};
$('#publishform').ajaxSubmit(options);
return false; // 为了不刷新页面,返回false

你可能感兴趣的:(jquery)