I am new to AJAX and PHP. I want to replace the value of a variable with null.
index.php
<script type="text/javascript" src="javascripts.js"> </script> <input type="submit" value="Set Value" onclick="makeRequest('index.php?testvalue=7', 'get', null); "/> <input type="submit" value="Unset Value 1" onclick="makeRequest('index.php?testvalue=null', 'get', null); "/> <h1><?php echo "PHP Test Value: " . $_GET['testvalue']; ?></h1>
I am trying to change the value of $_GET['testvalue'] to null whenever I click the Unset Value button, but what happens is that it does not change the variable $_GET['testvalue'] to null but instead it does something like $_GET['testvalue'] = 'null' ; It seems to me that it passes null as a string .
Moron source share