You're welcome, Martyn.

You changed the argument of this nested function and didn't change the
reference to it in the subsequent code:
function(d){

What about replacing it for:
function(j){

Your code would look like that:

<script src="http://127.0.0.1/django-medias/chantier/js/
jquery-1.2.3.js" type="text/javascript"></script>
 <script type="text/javascript" charset="utf-8">
$(function(){
  $("select#id_categorie").change(function(){
    $.getJSON("/admin/boutique/produit/getsubcategory/",{id: $
(this).val()},
function(j){
        alert("here")
      var options = '<option value="">---------</option>';
      for (var i = 0; i < j.length; i++) {
        options += '<option value="' + j[i].id + '">' + j[i].nom +
'</option>';
      }
      $("select#id_sous_categorie").html(options);
    })
alert("there")
  })

})
</script>


[]s
Diego Ucha


On 8 maio, 11:22, martyn <[EMAIL PROTECTED]> wrote:
> The Javascript Function does not seem to be executed.
> In admin_form.html :
>
> {% extends "admin/change_form.html" %}
>
> {% block extrahead %}
>  <script src="http://127.0.0.1/django-medias/chantier/js/
> jquery-1.2.3.js" type="text/javascript"></script>
> <script type="text/javascript" charset="utf-8">
> $(function(){
>   $("select#id_categorie").change(function(){
>     $.getJSON("/admin/boutique/produit/getsubcategory/",{id: $
> (this).val()},
> function(d){
>         alert("here")
>       var options = '<option value="">---------</option>';
>       for (var i = 0; i < j.length; i++) {
>         options += '<option value="' + j[i].id + '">' + j[i].nom +
> '</option>';
>       }
>       $("select#id_sous_categorie").html(options);
>     })
> alert("there")
>   })
>
> })
>
> </script>
> {% endblock %}
>
> The only alert I've got is [[there]] and never [[here]].
> All seems to be fine except this...
>
> An idea ?
>
> On 8 mai, 15:22, martyn <[EMAIL PROTECTED]> wrote:
>
> > That's it !
> > I'm discovering JQuery, not very "sexy" for the first time, but seems
> > to be really powerfull.
>
> > Thank you Diego.
> > Django community really rocks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to