I’m doing a simple AJAX post request in jQuery to another page on my site to get an XML document response. I’m putting the response into a pre element with syntax highlighting enabled. The response comes through fine (I can alert it), but it isn’t being added to thepre element when I attempt to assign it in the handlResponse function with jQuery.
<head>
<script>
...
function handleResponse(response, status)
{
$("#output").text(response);
}
$.post(url, data, handleResponse, "text");
...
</script>
</head>
...
<pre id="output">
</pre>
Just to be clear, the javascript code above is in jQuery’s document ready function. Any help would definitely be appreciated.
Apparently this is a bad question. I’m using the javascript lib SyntaxHighlighter and had preloaded the syntax highlighting on the
pretag I was attempting to use. My solution was to remove the tag and dynamically create it when the ajax response comes in. This worked well other than the fact that I’m trying to determine how to load the highlighting on a dynamically appended dom element.Thanks for the responses.