I've tried using AJAX, like told in the link below but yet unable to do:
http://stackoverflow.com/questions/19267531/how-to-open-jquery-ui-dialog-with-ajax-request
<p>Here's the worker object: {{ worker }}</p>
def popupadvance(request):
worker = Worker.objects.get(id=request.GET.get('worker_id')
return render(request, 'popupadvance.html', {'worker': worker})
from . import views
urlpatterns = [
url('popupadvance/$', views.popupadvance)
]
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
<a href="" onclick="return popitup('/popupadvance/?worker_id={{worker_id}}')">Advance </a>
<div id="dialog-form"></div>
function popitup(url) {
$.ajax({
url: url,
success: function(data) {
$("#dialog-form").load(data).dialog({modal:true}).dialog('open');
}
})
return false;
}
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/41199304-7a14-4d20-af30-eebce07e3ac7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
dataType: 'text',
Interesting. Maybe it should be $("#dialog-form").html(data) rather than load(data)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6e776a5d-869d-4c74-9adf-34fc4650093a%40googlegroups.com.
Here's the blog post, by popular demand :)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dd66d8cb-e5bc-44d9-bae4-7e6383508bc0%40googlegroups.com.
$.get(this.href, function(data){
$("#popup").html(data)
$("#popup").dialog({modal: true}).dialog('open')
})
$.get(this.href, function(data){
$("#popup").dialog({modal: true}).dialog('open').html(data)
})
$("#popup").dialog({modal: true}).dialog('open')).load(this.href)