Welcome Guest, Not a member yet? Register   Sign In
CI and jQuery help
#2

[eluser]MCrittenden[/eluser]
Do you mean that you want to submit the form and get the results dynamically, or do you mean you want data from the db to be used to populate the form before you submit? If you're talking about the first one, the jQuery Form plugin should do the trick. There are examples on the site, but basically you bind the function to the form using something like:
Code:
// wait for the DOM to be loaded
    $(document).ready(function() {
        // bind 'myForm' and provide a simple callback function
        $('#myForm').ajaxForm(function() {
            alert("Thank you for your comment!");
        });
    });

That will trigger an alert after the form is submitted. To get a little more useful, you can add the $data parameter to the callback function, and whatever the page that the form is sent to returns will be passed into the function. Something like this:
Code:
// wait for the DOM to be loaded
    $(document).ready(function() {
        // bind 'myForm' and provide a simple callback function
        $('#myForm').ajaxForm(function(data) {
            alert(data);
        });
    });

That will trigger an alert whose contents are whatever data the outside page sends back to your page. For a little more in depth example, I wrote a blog about making an AJAX contact form which displays a message depending on if the email was successfully sent or not. Check it out if you need to: http://capsizedesigns.com/blog/2008/04/a...th-jquery/

Hope that helps, and I apologize if I misunderstood your question!


Messages In This Thread
CI and jQuery help - by El Forum - 05-21-2008, 04:13 PM
CI and jQuery help - by El Forum - 05-21-2008, 04:33 PM
CI and jQuery help - by El Forum - 05-22-2008, 01:18 AM
CI and jQuery help - by El Forum - 05-22-2008, 01:42 AM
CI and jQuery help - by El Forum - 05-22-2008, 07:49 AM
CI and jQuery help - by El Forum - 05-22-2008, 08:08 AM
CI and jQuery help - by El Forum - 05-22-2008, 09:43 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:11 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:16 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:28 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:30 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:31 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:32 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:35 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:37 AM
CI and jQuery help - by El Forum - 05-22-2008, 10:40 AM
CI and jQuery help - by El Forum - 05-22-2008, 12:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB