Welcome Guest, Not a member yet? Register   Sign In
How to load a view from a jquery file
#1

[eluser]mojitoo[/eluser]
Hey!

I have the following ajax request in my file script.js that's placed outside the application folder in a folder called js.

Code:
$.ajax({
   url: base_url + 'comments/add_new_comment',
   type: 'POST',
   data: form_data,
   dataType : 'json',
   success: function(data) {
    $('#comment_wrapper').load('comments/show_comments');
   }
  });

I want to load the view comments/show_comments after success as you can see, but this doesn't work and I wonder how I should specify the url to be able to do this?
#2

[eluser]Stefan Hueg[/eluser]
Code:
$('#comment_wrapper').load('/comments/show_comments');

or

Code:
$('#comment_wrapper').load(base_url + 'comments/show_comments');




Theme © iAndrew 2016 - Forum software by © MyBB