javascript - Ajax - don't get Request -
i have javascript function use start request. need parameter of request, trying access through php not return anything. idea why? call js function in same php file through try access (index.php)
javascript:
function aufloesung() { var request = new xmlhttprequest(); request.open("get", "index.php?screen=1", true); request.send(); } php file:
<script> aufloesung(); </script> ... echo $_get["screen"] but don't parameter.
its easy using jquery , slicing index.php & ajaxphp files.
include jquery.js in index.php:
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script> <script> aufloesung(); </script> app.js:
function aufloesung() { $.ajax({ type: "get", url: "ajax.php?screen=1", success: function( data ) { alert( data ); } }); } ajax.php:
<?php echo $_get[ 'screen' ]; ?>
Comments
Post a Comment