pass js variable to php variable





How to pass the php date variable to javascript function.Remember to keep your php seperate from your javascript! JS will have a fit if you try and include a php variable Posted 7:42 am by muni filed under JAVASCRIPT, PHP.Here is simple solution to use value in client side (JavaScript) variable in server side PHP varaible : we need to pass values in JavaScript to server side using location.href JavaScript function in the url possible duplicate of How to pass JavaScript variables to PHP? LEON3245. Posts: 13. This will convert js variable to php variable. Im in a situation where I have to pass javascript variable to php without redirect (no get[]).1 I want js variable to be passed to php to use as a php variable (not viceversa ) 2 without redirecting 3 Is there any way to do this using ajax or cookies or post method. Lets call the file fb-response.js: JQuery( buttonid ).click( function() FB.api( /, delete ) ) Then register, enqueue and localize as seen above. Assuming that you have the ID youd like to pass in lets say fbid: Wpregisterscript I assume youre getting this error in your JavaScript code. This is because youre using a jQuery function but havent included the jQuery library. You can include it by putting the following line in the section of your HTML file: