Ajax response, when applied into html code, no css/styling?
Posted: Sat Nov 03, 2007 8:49 pm
When calling an Ajax url and a response is given back in HTML, the code returned (which has several <span class="this"> and <span class="that">) is not applied with proper CSS styling. Is this a normal occurance or am I just not seeing something wrong in my coding?
I'm using Prototype as the framework and my Ajax function call is as follows...
The responseText is returned as:
.comment_rating, .green, and .red are all specified in the CSS file I'm using and work perfectly with the HTML that is returned from a normal browser.
I'm thinking that it might be Prototype protecting itself from some sort of attack and just parsing out the HTML returned before spitting it out.
Anything look wrong here guys?
I'm using Prototype as the framework and my Ajax function call is as follows...
Code: Select all
function call_ajax_agree( id )
{
new Ajax.Request(
"/ajax.php?type=comment-agree&id=" + id,
{
method: 'get',
onSuccess: function( transport )
{
var response = transport.responseText || "<font style='color:red;'>error</font>";
$('comment_vote_' + id).replace(response);
},
onFailure: function(){ alert('Something went wrong...') }
}
);
}Code: Select all
<span class="comment_rating"><span class="green">+4</span>/<span class="red">-3</span></span> | agreedI'm thinking that it might be Prototype protecting itself from some sort of attack and just parsing out the HTML returned before spitting it out.
Anything look wrong here guys?