![]() |
Jquery & Submitting a form - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Jquery & Submitting a form (/showthread.php?tid=56252) |
Jquery & Submitting a form - El Forum - 12-05-2012 [eluser]downah[/eluser] Hi guys, finally codeigniter seems to make a little sense when I gave it another go making a simple project and learning individual things to get there as opposed to just following the "blog tutorial".. However I am trying to submit a form and do it through ajax/jquery so that the other page doesn't show and everything happens in one page. This is from my view where the form and jquery is: jquery: Code: [removed] form: Code: <form class="form-signin" method="post" id="form-signin"> It seems nothing happens when you click the submit button and I've put the script at the bottom of the page just before </body> as it seems when I put it under the form it doesn't load the rest of the code below it? I am very new with jquery so please be kind. I don't have anything in the script which the jquery should load (public function addmovie in the welcome controller) so it should return successfully I think? I hope someone can help me out! PS Using this tutorial: http://optimiseblog.co.uk/posting-form-data-using-codeigniter-and-ajax/ Jquery & Submitting a form - El Forum - 12-05-2012 [eluser]downah[/eluser] Got the jquery to work! seemed to be missing the url helper for the base_url I think so I added the full url and voila! form seems to work correctly as in submitting and jquery, although two things: it doesn't seem to take the information through as it keeps adding 0, 0, 0, 0 as opposed to the things I submit in the form. and next it doesn't refresh the page afterwards? probably something jquery missing? insert function in model: Code: function entry_insert(){ this is the controller function which gets called by the jquery loading the model: Code: public function addmovie() Code: <form class="form-signin" method="post" id="form-signin"> and finally jquery: Code: [removed] can anyone spot what I am doing wrong? and maybe help my jquery refresh? Jquery & Submitting a form - El Forum - 12-05-2012 [eluser]downah[/eluser] and again resolved! was missing name attributes in my form incase anyone is experiencing similar problems! <input placeholder="Kellys Score" id="kscore"> to <input placeholder="Kellys Score" name="kscore" id="kscore"> edit: location.reload(); added to jquery to make it reload! |