- Home /
This question was
closed Jan 04, 2013 at 03:26 PM by
Kryptos for the following reason:
Question is off-topic or not relevant
Question by
smdelacruz28 · Jan 04, 2013 at 01:40 PM ·
javascriptphp
how to pass AJAX into php
I have this kind of javascript, and inside this script I put an AJAX.
sed = $("#progressbar").progressbar("option", "value");
var getsed = sed +"ito to";
$.ajax({
type: 'POST',
url: 'lesson_stat.php',
data: {'variable': getsed},
});
this is my lesson_stat.php
<html>
<head>
</head>
<body>
<form action="lesson_stat.php" method="post">
<?
$myval = $_POST['variable'];
echo "<script type='text/javascript'>";
echo "alert('$myval')";
echo "</script>";
?>
</form>
</body>
</html>
the problem was, i cannot retrieve the $myval that was being pass by AJAX..
Comment
I'm guessing that this has little or nothing to do with Unity and you'd be better off posting your question elsewhere... StackOverflow?
Answer by Dave-Carlile · Jan 04, 2013 at 01:45 PM
This question would be better asked elsewhere since it's not strictly Unity related, but...
Looks like you're doing jQuery?
From the documentation, you need to specify a "success" event handler, which takes the results as one of the parameters.
http://api.jquery.com/jQuery.ajax/
success(data, textStatus, jqXHR)
This would be part of the data passed to $.ajax().