ajax提交不到后台

原创
2016-06-23 13:49:48 622浏览

PHP做一个短信验证的,ajax提交过去之后没反应

//002.根据手机号反回验证码,function getnum(){ if($("#tel").val()=="" || $("#tel").val()==null){  // 手机号为空校验    alert('提示:请输入手机号');  }else{  // 提交数据  $.ajax({    type: "get",    url: "http://www.diyiwuxian.com/tools/index.php?c=Phone&m=getactnum",    async: true,    dataType: "html",    data: {tel:$("#tel").val()},    success: function(data) {    // 返回-1.手机号格式 不对    if($.parseJSON(data).ret==-1){    $("#tel").focus();    $("#tel").val("");    alert('提示:请输入正确的手机号码!');    }else{    $("#num").val($.parseJSON(data).ret);    }    }    });    }}


//接口参数$classCName = @$_GET['c']?$_GET['c']:'';$method = @$_GET['m']?$_GET['m']:'';$method = isset($method) ? $method : "index";if ( !$classCName || !$method ) {	echo "controller or method is null";	exit();	}$classCName = $classCName."Controller";if(file_exists(HTDOC.'gmcontrollers/'.$classCName . ".php")) {	require_once (HTDOC.'gmcontrollers/'.$classCName . ".php");	$objC = new $classCName;		if(method_exists($classCName, $method)) return $objC -> $method();	else echo "class: {$classCName} not has method {$method}";} else {	echo 'no file';}


回复讨论(解决方案)

这个调试很简单的
php 什么都注释掉,直接echo一个字符串,看有没有东西返回

看看firebug有什么提示。

是不是跨域了?

1.检查提交之后,firebug的console是否报错。
2.提交的时候,追踪下url路径,看返回值是什么?

用firebug 等工具抓包看看,有什么返回

找到原因, 一个文件打不开

1.检查提交之后,firebug的console是否报错。
2.提交的时候,追踪下url路径,看返回值是什么?


Warning: include() [function.include]: Failed opening '/data/webserver/sites/diyiwuxian/lib/Auth.php' for inclusion (include_path='.:/data/webserver/php/lib/php') in /data/webserver/sites/ht/include/inc.php on line 16
文件问题,这是怎么回事?

文件 /data/webserver/sites/diyiwuxian/lib/Auth.php 不存在
请注意大小写

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
上一条:apache缓存怎么清理 下一条:布尔运算符