On Sat, Jun 30, 2012 at 11:54 AM, Psamathos <peter.murawski@gmail.com> wrote:
> If your web server is in fact serving the content with the incorrect
> Content-Type header (You can verify this by inspecting the response in the
> Net tab of Firebug or Chrome) jQuery can convert the response regardless of
> the content-type if you specify a two space-separated values in your
> dataType. Try dataType: "text html" in your $.ajax function.
I've been poking around with the debugger. For reference, here's the code:
var $form = $('form.roll');
url = $form.attr('action');
var $report = $('#report');
$.ajax({
url: url,
data: $form.serialize(),
dataType: 'html',
success: function (html, textStatus) {
$report
.html($('#report', html).html())
.css({
opacity: 1.0
});
style_preview_table();
}
The html variable passed into the success function contains the entire
page, including the javascript. I tried doing:
$report.html(html)
But the parts of the page that were not the results (i.e. #report) all
were duplicated (the page was displayed within the page). But even
there, the javascript wasn't included in the page, even though is was
in the html variable.
$('#report', html).html() contained just the html, without the
javascript. What I need is some way to get both the javascript and the
html of $('#report') and then pass that into $report.html(). Are there
javascript or jQuery methods that will allow me to do that?
Alternatively I could extract the javascript from the html variable
passed into the success function. But then how would I make that part
of $report.html()?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment