javascript - Js check login from exterior website -
i've create "like" button facebook. button on many web sites, calls javascript file hosted me, handle hover/click/etc.. action of button.
now, how can check if user logged or not in website (php sessions) js? if user logged button alter text , shows user liked it, otherwise user redirected(maybe popup) on registration page.
how can handle type of cross-domain(js/ajax) request?
to enable cross-domain requests, add together
header("access-control-allow-origin : *")
to top of php file.
then :
<?php if(isset($_session['user_logged_in']){ echo "true"; } else{ echo "false"; }
and take action on page based on value returned.
javascript php ajax
No comments:
Post a Comment