views:

58

answers:

1

I am currently implementing a registration form and doing the username availability checking using jquery and php.

In this case where the user_availability.php is in same folder as the registration from, it is easy to specify like the following to retrieve the function in the page.

$.post("user_availability.php",{ user_name:$(this).val() } ,function(data)

But what if my user_availability.php page is in the model folder? What should the URL be?

+1  A: 

There's nothing magical about jQuery here - you need to refer to user_availability.php in the same way that you'd refer to it in a link.

If it's in the root of your domain, refer to it as /user_availability.php.

If it's in a folder above where you are, refer to it as ../user_availability.php.

If it's in a sibling (models) of the folder where you are, refer to it as ../models/user_availability.php.

Dominic Rodger
I did what you told but it doesnt work. I'm using zend framework, so the page is in my controller and I did try many all the ways you have suggested but it doesnt work. Does using the framework affect the way its being called?
Ryan
@Ryan - what would be the full URL where you'd access `user_availability.php`? What would be the full URL where you'd access the page where you want to post data from? If you tell me those two things, I'll be able to help more.
Dominic Rodger