JQuery拆分ajax响应html问题

JQuery拆分ajax响应html问题,jquery,ajax,split,response,Jquery,Ajax,Split,Response,我在home.php中有一个ajax函数,它从deployate.php返回这个html响应 在deployate.php中,我总结了以下情况: if(a<b) {echo "yes.";} else {echo "no.";} echo<<<EO insert a title...aand something more! EO; 问题在于此,您只需查看警报即可理解: yes insert a title /*the alert doesnt show the

我在home.php中有一个ajax函数,它从deployate.php返回这个html响应

deployate.php中,我总结了以下情况:

if(a<b)
 {echo "yes.";}
else
 {echo "no.";}

echo<<<EO
insert a title...aand something more!
EO;
问题在于此,您只需查看警报即可理解:

yes  
insert a title
/*the alert doesnt show the rest of article var cause the dot:"...and something more!"*/
拆分函数再次拆分,即使我将其限制为2..为什么

谢谢大家
Luca

没有说“2后停止拆分”,而是说“正常拆分,只需给我前2个结果”

我想你想要的是这个:

var splitResult=response.split(".");  
var yesNo=splitResult[0];  
var article=splitResult.slice(1).join(".");
alert(yesNo+article);
…虽然我会使用不同的分隔符,例如:

var response = "yes|||insert a title...and something more!"
var splitResult=response.split("|||");  
var yesNo=splitResult[0];  
var article=splitResult[1];
alert(yesNo+article);

var response = "yes|||insert a title...and something more!"
var splitResult=response.split("|||");  
var yesNo=splitResult[0];  
var article=splitResult[1];
alert(yesNo+article);