3π
β
In case anyone had a similar problem, hereβs the final javascript I ended up using:
function upload_results_dialog($data_elem){
var $dialog_box = $("#ajax-dialog-box"),
data = $data_elem.attr("data");
$.ajax({
url: "../upload/" + data+ "/",
success: function(response){
$dialog_box.html(response);
$dialog_box.dialog("option",
{
title: "Upload",
height: 260,
width: 450,
buttons: {
Cancel: function(){
$(this).dialog('close');
},
Upload: function(){
upload($(this));
}
}
}
);
$dialog_box.dialog('open');
}
});
}
function upload($dialog_box){
var $form = $dialog_box.find("form"),
iframe = $dialog_box.find("iframe"),
$html = $($iframe.contents()),
$iframe_form = $html.find("form");
$iframe_form.html($form.contents());
//Set the onload function
$iframe.attr("onload","check_file_uploaded_valid()");
$iframe_form.submit();
}
π€Michael Merchant
3π
Ok I just spent hours with this same problem going through the js file line by line. It was working one second and then the next it wasnt. My problem was β I had deleted the target div for the results. Once i put that back in, it worked fine.
π€JD0000
- Jinja {% extends %}
- Django loading data from fixture after backward migration / loaddata is using model schema not database schema
- Django JWT Authentication behavior different between local & mod_wsgi servers with Django REST framework
- Where is Pip3 Installing Modules?
2π
Happened to me as well. Problem turned out to be the server wasnβt converting the entire object to proper JSON. Changed the return value to only the properties I needed:
return Json(new {Id = group.Id, Name = group.Name});
π€Jeff Borden
- Django's HttpResponseRedirect is http instead of https
- How do I make Django-Piston to include related child objects in the serialized output?
- Django Class Based Generic Views URL Variable Passing
0π
You need to call $('#form-id').ajaxForm();
in the document ready jQuery event so the plugin registers all the event handlers.
π€Luis Aguilar
- What is the difference between syncdb and migrate?
- Django calendar free/busy/availabilitty
- Add dynamic field to django admin model form
Source:stackexchange.com