Passing variable from jQuery to PHP on the same page -


please bear me, i'm new php. i'm using mixture of php , jquery on same page. need pass variables jquery php. examples came across describe how pass variables php file on server don't want. far manged convert object json using jquery $.tojson(); question is: possible pass jquery data php code if both jquery , php reside on same page?

here code far:

var myobject = {name: 'tomas', age: 38}; var encoded = $.tojson( myobject); var name = $.evaljson( encoded ).name; var version = $.evaljson(encoded).age; 

no not possible since php not client side script rather server side script. means time data given client php script have finished running. following demonstrates relationship between php , javascript:

server -> php -> client (browser) -> javascript

therefore, impossible have javascript communicate php on same page. can use ajax call server side file said - i'm afraid as can in terms of php , javascript communication


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -