Re: Ajax Form complete = not working with functions
not sure of your problem... but try to put the java function BEFORE the ajax calling and give it a try. Javascripts always mess with me in this kind of way... maybe it helps you. script type='javascript' function testCall() { alert('[EMAIL PROTECTED]');} /script ? echo $ajax-form('addComment', 'post', array( 'model' = 'Comment', 'url' = array('controller' = 'comments', 'action' ='add'), 'update' = 'pureGenius', 'complete' = 'testCall();')); ? .. On Oct 6, 3:55 pm, Chez17 [EMAIL PROTECTED] wrote: The complete option works fine if I put the javascript directly into the array. However if I try to put it in a function in the array it doesn't work. Take the following example: ? echo $ajax-form('addComment', 'post', array( 'model' = 'Comment', 'url' = array('controller' = 'comments', 'action' ='add'), 'update' = 'pureGenius', 'complete' = 'testCall();')); ? script type='javascript' function testCall() { alert('[EMAIL PROTECTED]');} /script If I put the alert in the ajax array, it works fine. Doesn't work as it stands. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Ajax Form complete = not working with functions
I figured it out! It took a couple of days, but here it is. I am not expert but here is what did it for me. For some reason, it doesn't work when you put the javascript on the page itself. It won't recognize the functions. But if you put it in an external file, it can see it. I don't know why, but it works. The solutions is to create an external .js file and link to it in your layout. Thanks for your time CG. On Oct 7, 12:50 pm, CG [EMAIL PROTECTED] wrote: not sure of your problem... but try to put the java function BEFORE the ajax calling and give it a try. Javascripts always mess with me in this kind of way... maybe it helps you. script type='javascript' function testCall() { alert('[EMAIL PROTECTED]');} /script ? echo $ajax-form('addComment', 'post', array( 'model' = 'Comment', 'url' = array('controller' = 'comments', 'action' ='add'), 'update' = 'pureGenius', 'complete' = 'testCall();')); ? .. On Oct 6, 3:55 pm, Chez17 [EMAIL PROTECTED] wrote: The complete option works fine if I put the javascript directly into the array. However if I try to put it in a function in the array it doesn't work. Take the following example: ? echo $ajax-form('addComment', 'post', array( 'model' = 'Comment', 'url' = array('controller' = 'comments', 'action' ='add'), 'update' = 'pureGenius', 'complete' = 'testCall();')); ? script type='javascript' function testCall() { alert('[EMAIL PROTECTED]');} /script If I put the alert in the ajax array, it works fine. Doesn't work as it stands. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ajax Form complete = not working with functions
The complete option works fine if I put the javascript directly into the array. However if I try to put it in a function in the array it doesn't work. Take the following example: ? echo $ajax-form('addComment', 'post', array( 'model' = 'Comment', 'url' = array('controller' = 'comments', 'action' ='add'), 'update' = 'pureGenius', 'complete' = 'testCall();')); ? script type='javascript' function testCall() { alert('[EMAIL PROTECTED]'); } /script If I put the alert in the ajax array, it works fine. Doesn't work as it stands. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---