当前位置:Gxlcms > PHP教程 > 新手求ajax返回值的有关问题

新手求ajax返回值的有关问题

时间:2021-07-01 10:21:17 帮助过:16人阅读

新手求ajax返回值的问题
ajax返回值进入showmsg函数,然后alert(tips)出函数返回的值,但是总显示undefined,是不是返回类型的问题,新手求教~
function showmsg(ms)
{
var tips
switch(ms)
{
case 'ding':
tips='thanx votting';
break
case 'cai':
tips='thanx u done';
break
case 'erro':
tips='404 notfound';
break;
default: tips='erro';
break;

}return tips;
}


------解决方案--------------------
var pass= str.replace(/\s+/g,""); 这个才是清楚空格,你那个是清楚换行

人气教程排行