Need help changing PHP variable with AJAX

Hello folks, hope everyone is having a great Sunday. Well I’m trying to use AJAX as the topic suggests, to change the value of a PHP variable with an onclick event. The variable ($set_stream_limit) is assigned a default value of 4 and I’m trying to change this value to 11 with the onclick event. So the idea is just to simply post some data to the server, onto the same file (member.php) that contains the variable and the onclick link. I’m not trying to get any response text back from the server. So somewhere on member.php page, I initialize the variable like so:

[php]//Define the stream limit variabe.

if(isset($_POST[“send_data”])) {

$set_stream_limit = $_POST["send_data"];

} else {$set_stream_limit = 4;}

echo $set_stream_limit;
[/php]

and somewhere down the page, I include the onclick event:
[php]
Set Limit
[/php]

Here is the AJAX code that’s supposed to perform the magic:

[php]

[/php]

Well I expect the printed value of 4 to change to 11 when I click on the link but it doesn’t. Am I making any sense at all with this approach? If so, where am I going wrong?

Sponsor our Newsletter | Privacy Policy | Terms of Service