jQuery .load()代码初始化页面

I am trying to build an Ajax suggestion feature within codeigniter using jQuery. However, when I am using the .load() function within jQuery I cannot find a way to call the controller, I am calling it as so:

$("#sugresultcontain").load('http://localhost/ajaxtest/suggest #loadsuggest');

However, the content does not load. I then tried to use:

$("#sugresultcontain").load('http://localhost/ajaxtest/application/views/ajaxref/suggest.php #loadsuggest');

And as expected, again this did not work as I need to make a call to the controller and not just the view itself.

So my question is, how can I use the .load() AJAX function to call to the controller that outputs suggest.php.

If more detail is needed, please just ask.

When you are having problems with AJAX requests, you can see server's response

  • in Google Chrome and in Internet Explorer by pressing F12 on tab Network
  • in Firefox by pressign CTRL+Shift+K

If you have allowed displaying errors, it will be there.