Powered by Invision Power Board



  Reply to this topicStart new topicStart Poll

> Loading form with AJAX request, using mootools
guillaume13
Posted: Apr 11 2011, 04:57 PM
Quote Post


Newbie
*

Group: Members
Posts: 1
Member No.: 2787
Joined: 11-April 11



So I am looking to have a view load a sub form for a quick search filter, I am using Mootools framework to load my page but the AJAX part of it works fine, my problem is getting the URL to my page sent properly since the controller assumes any path to be a new call to the controller and because of the modified page routing from cakephp I can't send a direct link to where my page is located either.

this is my code. the current code in the URL is the last thing I tried and doesn't work either I tried many ways to bypass this issue
CODE
<a href="#" onClick="myRequest.send();">Quick Search</a>
<div id="myElement">
</div>
<script type="text/javascript" src="/gfortin/robust/js/mootools-core-1.3.js"></script>
<script type="text/javascript">
var myElement = document.getElementById('myElement');

var myRequest = new Request({
   url: '<?php echo $this->Html->url('app/webroot/files/form.php', true); ?>',
   method: 'get',
   onRequest: function(){
       myElement.set('text', 'loading...');
   },
   onSuccess: function(responseText){
       myElement.set('html', responseText);
   },
   onFailure: function(){
       myElement.set('text', 'Sorry, your request failed :(');
   }
});

//document.id('myLink').addEvent('click', function(event){
 //  event.stop();
   //myRequest.send();
//});
</script>


any suggestions?
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Disclaimer:
This forum is in no way affiliated with the Cake Software Foundation
The CakePHP name and icon is a trademark of the Cake Software Foundation


Lo-Fi Version