创建jQuery的AJAX请求到一个PHP函数

问题描述:

创建Ajax请求,我一直张贴到一个单独的PHP文件时为止。是否有可能创建一个jQuery AJAX请求调用PHP函数,而不是职位,以一个单独的页面?

So far when creating AJAX requests I have been posting to a separate PHP file. Is it possible to create a jQuery AJAX request that calls a PHP function rather than posts to a separate page?

如果你可以给我任何实例或文档将是巨大的。

If you could send me any examples or documentation would be great.

AJAX请求调用一个URL(使一个HTTP请求)的不是一个文件的,在大多数情况下,URL时服务器翻译为指向一个文件(或你的情况PHP脚本),但所发生的一切从HTTP请求到收到的响应是由你(你的服务器上)。

AJAX requests call a URL (make a HTTP request), not a file, in most cases the URL is translated by the server to point at a file (or a php script in your case), but everything that happens from the HTTP request to the response that is received is up to you (on your server).

有映射URL的特定PHP函数许多PHP框架,AJAX只是访问URL并接收响应异步的方式。

There are many PHP frameworks that map URL's to specific php functions, AJAX is just an asynchronous way to access a URL and receive a response.

所述URL的可以触发服务器调用特定功能,并发送回一个响应。但它是由你来组织你的网址和服务器端,code这样。

Said URL CAN trigger the server to call a specific function and send back a response. But it is up to you to structure your URL's and server side code as such.