views:

30

answers:

2
 function new_review(){
    $.post('restaurant_profile/get_dg_new_restaurant_review', {}, function callback(response) {
          alert(response);
    }
 }

Hi I have a function that does an jQuery ajax post to a controller function. The function outputs a simple string using the PHP echo function.

The function works fine if I don't have any URI segments after the controller name in initial page load.

ex: mysite.com/index.php/test_controller/

If for example the page was loaded with a index function and the URI segment contained the index function

ex: mysite.com/index.php/test_controller/index

The response from the controller is all of the string output from the index function. this is entire page HTML. I only want the text from the et_dg_new_restaurant_review function

Does anyone know how to fix this?

A: 

actually i figured it out. the post url must be the full url

http://www.mystite.com/index.php/restaurant_profile/get_dg_new_restaurant_review

ot3m3m
A: 

actually it does not need a full url, you can try this:

"/index.php/restaurant_profile/get_dg_new_restaurant_review"

if you have done the Route Rewrite (to hide/remove the need of index.php), you can use this:

"/restaurant_profile/get_dg_new_restaurant_review"

jsut remember to start your url with "/"

Yman