I am trying to include an external php (on my own server) in another php page using jQuery AJAX from a select form.
basically I want to let the user include the external php file if they select YES option from the dropdown select form and remove it if they select NO.
I have the following code:
<html>
<head>
<script>
$('#test2').change(function(){
var selectedValue = $(this).val();
if (selectedValue === 'Yes') {
$("#content").load("include.php");
} else {
//WHAT DO I NEED TO PUT HERE TO REMOVE THE "include.php" if it has been inlcluded?
}
});
</script>
</head>
<body>
<form>
<select id="test2">
<option value=""></option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
</form>
<br>
<div id="content"></div>
</body>
</html>
First question: am I doing this right?
Second question: what do I need to do in order to remove the include.php file if they select NO option?
any help would be appreciated.
Thanks in advance.
P.S. i do have jquery included in my page.
include.phphave anything to do with your current page? What does it do? Second, you cannot exclude php the way you think. You need to explain what you are actually trying to do.