Creating custom AJAX requests

My question pertains to where I should create an ajax function that I’d like to call from my page view.

I am using a jQuery validator on a custom form that should check the inputted zipcode against my database of valid zipcodes.

Read More

I just need to know where this function should exist.

Normally when using a non wordpress site I’d create a PHP file with my ajax functions and call them by referencing the URL to this page and passing some parameters.

How can I achieve this with wordpress? Where can i explicitly call a php file and pass it arguments?

Note: I’d like to call the ajax function like so:

$.post('http://mysite.com/ajax-functions.php?fxn=zipcodes',
    {zipCode:00000},
    function(response){
      // do stuff
    });

Thanks

Related posts

Leave a Reply

1 comment