I have two input elements in my page.
<input type="button" id="
MyButton" onclick="SomeFunction()" value="click me" />
<input type="text" id="text" />
I'm trying to get "Hello World" text from my a1.ph
p using jQuery ajax, but I'm getting error, which says :
Network Error: Failed to execute 'send' on XMLHttpRequest: Failed to load 'file:///C:/a1.php'
Here's my javaScript function:
function SomeFunction()
{
//alert("AAAAAAAAAA");
jQuery("#text").val("AAA");
jQuery.ajax({
type: "GET",
url: "a1.php",
success: function() {
alert("OK");
},
error: function(jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
Please help me to fix this little problem.
Your a1.php file must be directly inside your C: drive with this code. If it isn't you'll get this error.
Seems like you path location isn't right, you can do something like:
...
url: '/a1.php' OR url: 'http://localhost/myproject/a1.php'
...