Ajax response seems to be getting lost

Posted by Ringo Blancke on Stack Overflow See other posts from Stack Overflow or by Ringo Blancke
Published on 2012-12-19T23:00:57Z Indexed on 2012/12/19 23:03 UTC
Read the original article Hit count: 159

I'm using the ddslick jquery dropdown plugin in conjunction with my Rails app.

In view1, I have

$('#challenges_dropdown').ddslick({
  <snipped>
  onSelected: function (data) {
    $.ajax({
      url: "/load_data",
      type: "GET",
      data: {"id": data.selectedData.value}
    });
  }
});

I.e., I make a call to my controller to load_data. The controller receives this correctly and then at the end, makes a call to render a separate view

render "data"

This view contains a script snippet that needs to run in order to update some elements of my original view. For some reason, this script snippet is just not running.

I'm very confused. When I use a regular link with data-remote="true", then the whole process works perfectly. However, when I make an AJAX call, it fails.

What's going on??

Thanks! Ringo

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery