Home  >  Article  >  Backend Development  >  新手求ajax返回值的有关问题

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

WBOY
WBOYOriginal
2016-06-13 12:48:31771browse

新手求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,""); 这个才是清楚空格,你那个是清楚换行
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn