Hi, I have a bit of a problem.
I have an ajax request that is sent out to do a database update. A response is then returned that looks like:
...
...
</head>
<body class="contentpane">
{"id":"27","votes":14,"sum":45,"avg":"3.2"}
</body>
</html>
How can I get the contents of body class "contentpane" and then convert this to a JSON object?
My request function looks like this:
jQuery.post("index.php?option=com_ttvideo&task=savevote&tmpl=component", {rate: value, id: <?php echo $this->video->id; ?> }, function(html)
{
// get contents of "contentpane" from response html
// convert to JSON object e.g.
// var rating = jQuery.parseJSON(content_of_body);
// is the above JSON parse correct?
// Select stars to match "Average" value
ui.select(Math.round(rating.avg));
// Update other text controls...
jQuery("#avg").text(rating.avg);
jQuery("#votes").text(rating.votes);
// Show Stars
jQuery("#loader").hide();
jQuery("#rat").show();
});