• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AJAX request path

#4
[eluser]carbona[/eluser]
Well i was talking about the whole application when i wrote about base_url() function.

You could do this another way. Create a controller and a method for you ajax calls.

Create a javascript file named config.js where you will have something like this :

var base_url = [removed].protocol+"//"+[removed].hostname+"/";

Include this js on top of all others js files in head.

When you will move your applications everything will be working fine, and you dont need any other changes.

When making ajax calls :
Code:
new Ajax.Request(base_url+"yourcontroller/yourmethod",
        {
          method: 'post',
          postBody: 'name='+ $F('name'),
          onComplete: showResponse
        });
}


Messages In This Thread
AJAX request path - by El Forum - 04-15-2011, 02:40 AM
AJAX request path - by El Forum - 04-15-2011, 06:57 AM
AJAX request path - by El Forum - 04-15-2011, 07:29 AM
AJAX request path - by El Forum - 04-15-2011, 07:54 AM
AJAX request path - by El Forum - 04-15-2011, 07:55 AM
AJAX request path - by El Forum - 04-15-2011, 08:03 AM
AJAX request path - by El Forum - 04-15-2011, 09:41 AM
AJAX request path - by El Forum - 04-15-2011, 02:09 PM
AJAX request path - by El Forum - 04-15-2011, 03:24 PM
AJAX request path - by El Forum - 04-16-2011, 10:13 AM
AJAX request path - by El Forum - 04-18-2011, 10:03 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.