I am doing the following:
<script type="text/javascript">
$(function(){
$("#ipad").submit(function() {
$.post("ipadcheck.php", $("#ipad").serialize(),
function(data)
{
if(data.error == 'TRUE')
{
$("#results_ajax").html("<div class='AppleRed'>Sorry There were Errors: " + data.error_message + "</div>");
}
else
{
$("#results_ajax").html("<div>"+ data.disp + "</div");
}
}, "json");
return false;
});
});
When the user enters data into a form and submits the form gets submitted. I know that data.error == 'TRUE'
gets hit because when I cause an error on purpose I get my error message.
I know that I am building up the results for data.disp
as they are:
<div class='paragraph_style'><br />
<strong> San Jose College Park</strong>
<br/>2.33 miles<br />Out Of Stock
<strong> San Jose Westgate</strong>
<br/>3.35 miles<br />Out Of Stock
</div>
Using Firebug I see this come back, It looks good
But it does not get displayed.
I have been pulling my hair out for 3 hours!
UPDATE: Definitely a problem with my string, an encoding issue. I replaced my string with the work "Hello" and it works. Why did I not think of such a simple test sooner...
UPDATE 2: I am using this:
$m=array();
preg_match_all('/<p>[\s\S]*?<strong>([\s\S]*?)<\/p>/i',$buffer,$m);
foreach($m[1] as $mnum=>$match)
{
$displayString .="<br /><strong>";
$displayString .= $match;
$displayString .="<br />";
}
It is this line $displayString .= $match;
Maybe I don't know how to output the value of $m[1]
? What happens here is $buffer
is curl output and I find all instances of
and they go into $m. Any advice?
EDIT: I tried wrapping the jquery .html()
in a try/catch
and nothing happens, I never hit it or get the alert.
try
{
$("#results_ajax").html("<div>"+ data.disp + "</div>");
alert($("#results_ajax").html());
}
catch(err)
{
txt="There was an error on this page.
";
txt+="Error description: " + err.description + "
";
txt+="Click OK to continue.
";
alert(txt);
}