Results 1 to 2 of 2

Thread: Where should AJAX files go?

  1. #1
    Thread Starter
    Amateur findlorenz's Avatar
    Join Date
    Apr 2011
    Posts
    19
    Thanks
    0
    Thanked 1 Time in 1 Post

    Where should AJAX files go?

    I've got some functions in general.js that need to GET some info via xmlHttpRequests. What would be the best practice for targetting the php file that handles the request?

    Code:
    xmlhttp.open("GET","http://www.mainurl.www/ajax_postform.php?country="+document.mainform.cp_country[document.mainform.cp_country.selectedIndex].value,true);
    I'd rather not put it in the root directory as above. When I do so, the php file doesn't seem to be able to instantiate a globalized $wpdb and I can't call any of its functions. Where should I drop this ajax_postform.php file so that it's easily written in my js, and can also obtain the global $wpdb?

  2. #2
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [MOD NEEDED] Ajax Pagination
    By pinocchio in forum ClassiPress General Discussion
    Replies: 5
    Last Post: November 21st, 2012, 07:06 PM
  2. [MOD NEEDED] Clicking next page by using Ajax
    By jlei1989 in forum ClassiPress General Discussion
    Replies: 18
    Last Post: August 7th, 2012, 10:31 AM
  3. Disable ajax loader
    By garyb in forum ClassiPress General Discussion
    Replies: 1
    Last Post: May 5th, 2011, 06:51 AM
  4. loading via javascript or in ajax way
    By navjottomer in forum Help Using ClassiPress
    Replies: 1
    Last Post: May 23rd, 2010, 08:08 AM