如何在JavaScript中调用PHP函数 [英] How to call php function in javascript
本文介绍了如何在JavaScript中调用PHP函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在javascript中调用php函数?
如何在jquery中调用php函数?
How to call php function in javascript?
How to call php function in jquery?
推荐答案
没有在jQuery中"之类的东西,因为jQuery也是JavaScript.从JavaScript的角度来看(假设您使用的是客户端JavaScript,而服务器端的JavaScript使用很少),则没有"PHP"之类的东西可以在服务器端使用.当PHP生成的页面已经发送到客户端并已加载时,JavaScript起作用.结果就是HTML.
-SA
There is no such thing as "in jQuery", because jQuery is also JavaScript. From the JavaScript standpoint (I assume you use client-side JavaScript, server-side JavaScript is not used much), there is no such thing as "PHP", which works on the server side. JavaScript comes into play when a page generated by PHP is already sent to the client and loaded; the result of it is just HTML.
—SA
在javascript/jquery中调用php函数
您需要使用AJAX.使用传统的XMLHttpRequest或jQuery定义的.ajax方法.
http://api.jquery.com/jQuery.ajax/ [ http://api.jquery.com/category/ajax/ [ http://www.w3schools.com/jquery/jquery_ref_ajax.asp [
call php function in javascript/jquery
You need to use AJAX. Use traditional XMLHttpRequest OR jQuery defined .ajax method for it.
http://api.jquery.com/jQuery.ajax/[^]
http://api.jquery.com/category/ajax/[^]
http://www.w3schools.com/jquery/jquery_ref_ajax.asp[^]
这篇关于如何在JavaScript中调用PHP函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文