Getting variable value from PHP with jQuery

前端 未结 4 1508
一向
一向 2021-01-16 07:50

So how do i get variable value from php file with jquery...? the jquery code is in other file (tpl)

for example i have register.php and register.tpl (template file f

4条回答
  •  终归单人心
    2021-01-16 08:16

    In situations where my company's application needs to call Jquery on a dynamic element and we have the Jquery call IN the php file we'll directly call php in the Jquery call.

    For example:

    alert($('#').val());

    Not for all situations, certainly. If you have to call a variable where you don't have PHP access to the file (possibly such as a .tpl file, depending on your setup) you might resort to setting a hidden input as detailed above.

提交回复
热议问题