Send Wordpress $current_user->ID From Php File To External Javascript File
I am trying to dynamically load a KML file into a map depending on which buddy press user is logged in. Everything works fine when I hardcode a userID in the javascript file, but I
Solution 1:
As my earlier comment suggested, I think this will solve your issue:
In the js file:
...
function initialize(current_user) {
...
}
...
In the php:
...
<script type="text/javascript">
$("#address1").click( function() {
initialize(<?=json_encode($current_user->ID)?>);
});
</script>
...
Post a Comment for "Send Wordpress $current_user->ID From Php File To External Javascript File"