有和页面方法类似的东西吗? (使用Ajax执行服务器端功能) [英] There is something similar as Page Methods? (Using Ajax to execute server side function)
问题描述
大家好.
我使用ASP.NET AJAX做这样的事情:
html按钮:
< button onclick ="writeSomething();">
然后用JS
PageMethods.writeSomething(something);
然后在服务器端:
Hello people.
I used ASP.NET AJAX to do something like this:
html button:
<button onclick="writeSomething();">
and then with JS
PageMethods.writeSomething(something);
and then on serverside:
[WebMethod]
public static void writeSomething(string something)
这是非常有用的.我想知道如何使用PHP作为服务器端语言.我知道PHP是一种纯服务器端语言,我已经看过jQuery和一些框架的一些解决方案,但是我想知道是否可以通过其他方式来实现.
非常感谢.
This is pretty usefull. I would like to know how could I to the same with PHP as server side language. I know PHP is a pure server side language, I''ve seen some solutions with jQuery and some frameworks, but I''m wondering if I can do that other way.
Thank you very much.
推荐答案
PHP没有类似的方法. PHP Web服务就像其他语言一样使用SOAP或XML-RPC协议.看看他们的手册
http://php.net/manual/en/refs.webservice.php [ ^ ]
您可能需要使用XmlHttp对象使用Ajax连接到服务. jQuery内置了ajax函数,该函数在后台使用XmlHttp.
PHP don''t have similar methods. PHP webservices are like other languages use SOAP or XML-RPC protocols. Have a look at their manuals
http://php.net/manual/en/refs.webservice.php[^]
You may need to use the XmlHttp object to connect to the service using ajax. jQuery have inbuilt ajax function which under the hood use XmlHttp.
这篇关于有和页面方法类似的东西吗? (使用Ajax执行服务器端功能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!