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";
		  type: 'POST',
		  url: 'lesson_stat.php',
		  data: {'variable': getsed},

this is my lesson_stat.php

		<form action="lesson_stat.php" method="post">
			$myval = $_POST['variable'];
			echo "<script type='text/javascript'>"; 
			echo "alert('$myval')";
			echo "</script>";  

the problem was, i cannot retrieve the $myval that was being pass by AJAX…

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.

success(data, textStatus, jqXHR)

This would be part of the data passed to $.ajax().