Hi,
I am trying to get some xml data using a jquery .post request, but it's not outputting anything. The client-side code looks like this
<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
function cstarter()
{
window.einterval = setInterval("cst()", 5000);
window.big = "hi";
}
</script>
<script type="text/javascript">
function cst()
{
$.post("testback.php", { csize: window.big },
function(theXML){
$('label',theXML).each(function(i){
window.creply = $(this).find("numb").text();
window.cnumb = $(this).find("rep").text();
});
$('.inner').append(window.creply);
$('.inner').append(window.cnumb);
});
}
</script>
</head>
<body>
<div class="inner" >
</div>
<script type="text/javascript">
cstarter();
</script>
</body>
</html>
And the server-side looks like this:
<?php header('Content-Type: application/xml; charset=ISO-8859-1')?>
<?php
$cnumb = $_POST["csize"];
$ccrank = "$cnumb"."small";
$ctest = "yeahhh";
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<labels>
<label>
<rep>$ccrank</rep>
<numb>$ctest</numb>
</label>
</labels>
";
?>
Sorry if it's a bit ugly, but I've cut out everything except the problem areas and the result is a bit of a mess. If anyone can see why this isn't working I'd really appreciate the help.
Thanks