so have php file on server handles http post requests. when receives post request, runs javascript script.
currently have script echo'...'; problem script inside echo, sends raw code place http post generated without running script.
is there way can run script without echoing back.
thanks
<?php define('verify_token', 'abc'); $method = $_server['request_method']; if ($method == 'get' && $_get['hub_mode'] == 'subscribe' && $_get['hub_verify_token'] == verify_token) { echo $_get['hub_challenge']; } else if ($method == 'post') { echo ' <script type="text/javascript" src="parse-1.4.2.min.js"></script> <script type="text/javascript"> parse.initialize("id1", "id2"); var testobject = parse.object.extend("test"); var testobject = new testobject(); testobject.set("key", "post"); testobject.save(); </script>'; } ?>
you can try
<?php else if ($method == 'post') {?> <script type="text/javascript" src="parse-1.4.2.min.js"></script> <script type="text/javascript"> parse.initialize("id1", "id2"); var testobject = parse.object.extend("test"); var testobject = new testobject(); testobject.set("key", "post"); testobject.save(); </script> <?php } ?>
else don't think there other way
Comments
Post a Comment