Welcome Guest, Not a member yet? Register   Sign In
SOLVED: CI + jQuery forms
#1

[eluser]stevefink[/eluser]
Does anyone have any experience with using jQuery forms within CI?

I have a really simple target: callback which works fine outside of CI:

Code:
$(document).ready(function() {
    // bind 'form2' and provide a simple callback function
    $('#form2').ajaxForm(function() {
        // Server should send data back in json encoding
        target: '#container'
    });  
});


all that should do is pop in the response of my script into <div id="container></div>. I'm not getting any errors, just not seeing updated content. My action method looks like this:

Code:
function photo_mod()
    {
        /**
         * Process photo modifications here. The form from photos_view.php
         * gets process in this method.
         */    
        echo  "<pre>DEBUG TEXT</pre>";
    }

Thanks all.
#2

[eluser]stevefink[/eluser]
I figured this out in case anyone runs into the same issue. .ajaxForm() is expecting a parameter listed .. not a callback function with a parameter list.

The following syntax is the proper way to get this working:

Code:
$(document).ready(function() {
    // bind 'form2' and provide a simple callback function
    $('#form2').ajaxForm(
        {
            target: '#container',
            type: 'post'
        }
        
    );
});
#3

[eluser]CodeOfficer[/eluser]
Good to know I'll be using this soon, thanks for posting.
#4

[eluser]worchyld[/eluser]
Are there any working live *simple* examples of jQuery and CI working together. Something stupidily simple, like an autocomplete, or jQuery FX.




Theme © iAndrew 2016 - Forum software by © MyBB