![]() |
jquery post - 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: jquery post (/showthread.php?tid=23915) Pages:
1
2
|
jquery post - El Forum - 10-25-2009 [eluser]marjune[/eluser] ei pipz, my script in jquery using post didn't work!! my jq script Code: $(".topicans").click(function(){ jquery post - El Forum - 10-25-2009 [eluser]eric cumbee[/eluser] ive found that using base_url() in your .post url works alot better, some times it worked for me with it other times it didnt. jquery post - El Forum - 10-25-2009 [eluser]marjune[/eluser] i already try this but nothing's happen Code: $.post("<?php base_url().'furoms/viewthread' ?>", {topic: topic_id}); jquery post - El Forum - 10-25-2009 [eluser]Ben Edmunds[/eluser] Try this: Code: $.post("<?php echo base_url();?>furoms/viewthread", {topic: topic_id}); You have to echo the base_url() function as it doesn't output automatically. jquery post - El Forum - 10-25-2009 [eluser]marjune[/eluser] i try but nothing Code: $.post("<?php echo base_url();?>furoms/viewthread", {topic: topic_id}); jquery post - El Forum - 10-25-2009 [eluser]Ben Edmunds[/eluser] What is the error your getting? No response? Please post your controller that this posts to. Thanks, jquery post - El Forum - 10-25-2009 [eluser]marjune[/eluser] no response ! my controller Code: function viewthread(){ jquery post - El Forum - 10-25-2009 [eluser]Ben Edmunds[/eluser] Alright, So your doing: Code: $(".topicans").click(function(){ and then what do you want to happen? You need to add the data callback on your post function if you want to display something. For example: Code: $(".topicans").click(function(){ Also note, your posting id but your controller is expecting topic_id. jquery post - El Forum - 10-25-2009 [eluser]marjune[/eluser] i dont want a call back! what i want to happen is after posting the data from jquery, i let the the controller to do the thing here Code: function viewthread(){ to the next view('thread'); jquery post - El Forum - 10-25-2009 [eluser]Ben Edmunds[/eluser] Well the post function is doing an ajax request so I think one of us is misunderstanding something... Are you wanting to load a different page when topicans is clicked? If so, why not just use a link like href="controller/viewthread/1"? For reference, http://docs.jquery.com/Ajax/jQuery.post |