php 调用 ajax 返回值,在jQuery.ajax成功处理程序中使用来自PHP脚本的返回值的问题...

我从jQuery ajax请求发送表单细节到一个PHP脚本,得到了一个奇怪的结果。相同的脚本可以在其他地方免费使用。基本上这个表单是使用jQuery.ajax这样提交的:

//if submit button is clicked

$('#form1').submit(function () {

//Get the data from all the fields

var name = $('input[name=name]');

var email = $('input[name=email]');

var con_email = $('input[name=con_email]');

var comments = $('textarea[name=comments]');

//organize the data properly

var data = 'name=' + name.val() + '&email=' + email.val() + '&con_email=' + con_email.val() + '&comments=' + encodeURIComponent(comments.val());

//show the loading sign

$('.loading').show();

//start the ajax

$.ajax({

//this is the php file that processes the data and send mail

url: "process-email/process.php",

//GET method is used

type: "GET",

//pass the data

data: data,

//Do not cache the page

cache: false,

//success

success: function () {

//if process.php returned 1/true (send mail success)

if (html==1) {

//hide the form

$('.form').fadeOut('slow');

$('.done').delay(1000).fadeIn('slow');

}

}

});

//cancel the submit button default behaviours

return false;

});PHP脚本正常工作,发送电子邮件并返回1(发送电子邮件),但脚本停在:if(html==1)。我得到这个错误

html is not defined如上所述,完全相同的脚本在其他地方工作正常,但在这里我得到该错误,脚本停止。有人可以帮助了解可能出现问题的位置吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值