jquery-ajax Find a text posted
I have this simple attacched code, I can get right text on the first debug alert but the search and if condition doesn't work, what is wrong in my code? Or there is a better way to do t开发者_Go百科he same?
thanks in advance
ciao h
$.post("./php/piattaforma.php",
{azione:"valida_pia", contratto:contratto},
function(xml)
{
$(xml).find("sel_mess").each(function()
{
var messaggio=$(this).text();
alert(messaggio);
var str=messaggio.search("text");
if (str!=-1)
{
alert("ok");
}
});
},"xml"
);
This should work. Got capital letters in the word text? If so use
var str=messaggio.search(/text/i);
精彩评论