EllisLab text mark
Advanced Search
     
SOLVED: CI + jQuery forms
Posted: 29 August 2007 06:38 PM   [ Ignore ]
Avatar
Joined: 2007-08-09
239 posts

Does anyone have any experience with using jQuery forms within CI?

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

$(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:

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.

 
Posted: 29 August 2007 09:07 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-08-09
239 posts

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:

$(document).ready(function() 
    
// bind 'form2' and provide a simple callback function 
    
$('#form2').ajaxForm(
        

            target
'#container'
            
type'post' 
        
}
        
    
);
}); 
 
Posted: 29 August 2007 10:58 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-07
65 posts

Good to know I’ll be using this soon, thanks for posting.

 Signature 

Mac Pro 4x3ghz, 1.8TB HD, 4G RAM, Dual 20” Screens in the house ... *drool*

 
Posted: 31 August 2007 02:20 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2007-01-25
31 posts

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