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

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -