Hello, I have little problem with ajax request.
$(function() {
$("#sort").sortable({ opacity: 0.6, cursor: 'move', update: function() {
var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
$.post("uprav", order, function(theResponse){
$("#contentRight").html(theResponse);
});
}
});
});
I created drag and drop script with JqueryUI and I call php function uprav.
In site controller I created function:
public function action_uprav()
{
echo "ahoj";
}
It works, the function is called, but it want to rander the all view again. And show me this error:
Notice!
ErrorException [ Notice ]: Undefined variable: content
APPPATH/views/template.php @ line 195:
194: <div class="span16">
195: <?php echo $content; ?>
196: </div>
I want only to call function witch only return data, I don want rander the view again.
Can you help me ? ... Sorry for my english
Thanks, and how Can I call this uprav function in thi controller ?
My position when I call ajax is: [url=http://localhost/phpframework/public/index.php/site/]http://localhost/phpframework/public/index.php/site/[/url]
Ajax :
$.post("ajax/uprav", order, function(theResponse)....
Calling "ajax/uprav" don´t work, because it create this url: public/index.php/site/ajax/uprav but i need create this url without "site": public/index.php/ajax/uprav
How Can I do it ?
You need to request the full URL. Normally, your rewrite rules will remove the public/index.php part from your URL, and you can just call '/ajax/uprav'.
You can try using Uri::create() to generate the URL, it should create the correct URL for you.