ci + jquery |
[eluser]ardinotow[/eluser]
Thanks mate...Now I can use codeigniter validation to validate form in ajax way. I have more question. Supposed I have one page that contain comment form and comment list. If I post new comment I want to get these instance: 1. The form is validate using ajax, and when no errors occur my new post will be inserted in database then showing 'input success' message (all in ajax way). 2. While showing 'input success' message, the comment list will refreshed in ajax. I know how to do the first instance, but I don't know how to do the second instance. Please anyone help me to get this work. p.s. Here is my jquery script for doing the first instance Code: // GLOBAL PARAMS
[eluser]onejaguar[/eluser]
Assuming you are using CSS layout for your comments, something like: Code: <div id="comment_container"> you could have your "do_input_ajax" routine return another variable containing the processed text of the new comment, so when data.success == 'true' it will also pass data.comment_html. In "ShowResult()" add this line to the "true" block: Code: $('#comment_container').append('<div class="comment">'+data.comment_html+'</div>'); You could also do a second ajax request to get the comment data but less requests is better!
[eluser]ardinotow[/eluser]
@onejaguar Awesome, thanks dude. I Love CI+jquery ;-P
[eluser]aster1sk[/eluser]
I did a little video tutorial on this - hope it helps. How To : CodeIgniter, jQuery & JSON
[eluser]boltoncole[/eluser]
Hey Summer Student! Really thanks for your video! Your site is really great ^^
[eluser]aster1sk[/eluser]
[quote author="boltoncole" date="1261099174"]Hey Summer Student! Really thanks for your video! Your site is really great ^^[/quote] boltoncole - thank you very much, expect more goodies in the near future now that I have teamed up with CodyPChristian
[eluser]excelln[/eluser]
[quote author="Gavin Blair" date="1211712454"]@ardinotow: I have the entire thing here: http://zoeandgavin.com/wpmu/php/2008/05/...e-igniter/ (there is a download link at the end) If you want to put more than one input, use the syntax: {id: id.value, username: username.value} - just separate with commas. The controller just gets the stuff from the database and echoes out the result. You can use another view and have the controller pull it in, just know that the entire view will go into your div.[/quote] Gavin Blair, could you please take a look at the zip file on your website? I downloaded the zip file; when I am trying to unzip it, I got an err msg saying that the zip file is either in unknown format or damaged. Thank you!
[eluser]daK[/eluser]
[quote author="excelln" date="1276591614"][quote author="Gavin Blair" date="1211712454"]@ardinotow: I have the entire thing here: http://zoeandgavin.com/wpmu/php/2008/05/...e-igniter/ (there is a download link at the end) If you want to put more than one input, use the syntax: {id: id.value, username: username.value} - just separate with commas. The controller just gets the stuff from the database and echoes out the result. You can use another view and have the controller pull it in, just know that the entire view will go into your div.[/quote] Gavin Blair, could you please take a look at the zip file on your website? I downloaded the zip file; when I am trying to unzip it, I got an err msg saying that the zip file is either in unknown format or damaged. Thank you![/quote] +1 I'm very interesting in seeing how you make it work too. Unfortunately the link is dead... Could you (or a fellow member) kindly re-upload it and share it with some of us inexperienced CI-late-commers? Thanks |
Welcome Guest, Not a member yet? Register Sign In |