I have installed XAMPP to run PHP files on my computer, here is my PHP file I am attempting to execute
<?php
if(isset($_GET['input']))
{
$string = $_GET['input'];
echo strrev($string);
}
?>
Here is my basic HTML file
<html land="en">
<head>
<meta carset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css";
</head>
<body>
<!-- Document Ready Event -->
<input id="text" type="text" /><input id="submit" type="button" value="Submit" />
<div id="feedback"></div>
<script src="../jquery-1.10.2.min.js"></script>
<script src="script.js"></script>
</body>
</html>
And here is my JS file
//Pass a value to a PHP file and taking the contents and showing the contents
$('#submit').click( function()
{
var text = $('#text').val();
$.get( 'C:/xampp/htdocs/amit/reverse.php', { 'input': text }, function( data )
{
$('#feedback').text( data );
});
});
When the button is clicked Chrome tells me the this.
Header is
Request URL:file:///C:/xampp/htdocs/amit/reverse.php?input=Hello
Query String Parametersview sourceview URL encoded
input:Hello
and the Response is
<?php
if(isset($_GET['input']))
{
$string = $_GET['input'];
echo strrev($string);
}
?>
Now I have put a different file on my XAMPP PHP side and it works fine, but this one just doesn't response, can anyone see what I am doing wrong at all?