Javascript call from controller result possible? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Javascript call from controller result possible? (/showthread.php?tid=3194) |
Javascript call from controller result possible? - El Forum - 09-15-2007 [eluser]Robb__[/eluser] I have tried a thing to control javascript actions: Code: var myAjax = new Ajax.Request('www/index.php/test/anAjaxCall/',{onComplete:test_response}); Code: function anAjaxCall() { in test_response Quote:function test_response(){ Code: function testIfWorks(text){ Is there something missing or is it not possible? Javascript call from controller result possible? - El Forum - 09-15-2007 [eluser]Sector[/eluser] [quote author="Robb__" date="1189879186"] Code: function anAjaxCall() { Why don't you try something like: Code: function anAjaxCall() { Because I think that returning your text doesn't do much :$ Javascript call from controller result possible? - El Forum - 09-17-2007 [eluser]obiron2[/eluser] the javascript is running client side. if you are doing Code: function testIfWorks(text){ in your controller/model this is running server side and will do nothing. If you are doing it client side in the #script# tags then text has not been set becuase "return $resul" is only adding $result to the CI object, it is not actually sending it via HTTP. You still need to generate the output using an echo, print or $this->view('your_view',$data) construction. hope this helps obiron |