Jump to content

Codeigniter Jquery & Form Submitting


Recommended Posts

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:



	 dataString = $("#form-signin").serialize();

	   type: "POST",
	   url: "<?php echo base_url(); ?>index.php/welcome/addmovie",
	   data: dataString,

	   success: function(data){


	 return false;  //stop the actual form post !important!





   <form class="form-signin" method="post" id="form-signin">
    <h4 class="form-signin-heading">Add a Movie</h4>
    <input type="text" class="input-block-level" placeholder="Movie Title">
    <input type="text" class="input-block-level" placeholder="URL">
    <input type="number" class="" min="1" max="100" placeholder="Jamies Score">
    <input type="number" class="" min="1" max="100" placeholder="Kellys Score">
    <button class="btn btn-large btn-primary" type="submit">Add</button>


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....niter-and-ajax/

Edited by downah
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.