I am trying to delete a string from a string, but the result of strstr is not finding the string. I will try to be as clear as I can here....
The problem is strpos() is not finding $deletTabHTML. I have alerted it in ajax and it is exactly the same as a line in the commonHTML, but obviously it isn't for some reason I cannot figure out. I am assuming I am missing something 'invisible'? My script works if I hardcode the html to be deleted, so the overall script works.
here is the php:
$commonHTML = file_get_contents($url);
if (!empty($_POST['action']) && $_POST['action'] == 'deleteTab') {
$deletTabHTML = trim($_POST['theHTM']);
if(strpos($commonHTML, $deletTabHTML) !== false) {
$is_deleted="deleted";
}else{
$is_deleted="NOT deleted, ERROR:".$deletTabHTML;
}
echo '{"is_deleted":"' . $is_deleted . '"}';
return;
}
MORE INFO: jQuery is getting an element from the dom and sending it to a php script which is opening a file and deleting the element:
<li id="contact"><a href="#contact" rel="ajax">Contact</a></li>
The data returned to ajax is:
<li id="contact"><a href="#contact" rel="ajax">Contact</a></li>
but for some reason it is not finding it. Thos were copied and pasted from the actual file and a javascript alert. They look exactly the same.
I hope that is enough info.