GAksut GAksut - 22 days ago 4
Ajax Question

My simple jQuery Ajax call doesn't work

This URL

Gets this:

{"SayHelloResult":"{\"Status\":1,\"Message\":\"Hello Joe Smith\"}"}

But my
call doesn't work. The full HTML page is shown below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title>Say Hello</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function () {
$('#btn_SayHello').click(function (e) {
type: 'Get',
url: '',
dataType: 'json',
success: function (response) {
error: function (jqXHR, textStatus, errorThrown) {
alert('Error = ' + errorThrown + ' -- ' + jqXHR.responseText);
Full Name:<br />
<input id="txt_Email" type="text" style="width: 300px;" />
<br /><br />
<input id="btn_SayHello" type="button" value="Say Hello" />
<br /><br />


Well I have tested in my local, The code is executing correctly if you use a local JSON. But If you want the Json from that perticular URL, I am getting , "Access denied",

Below is the error,

XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

i.e. , you are doing an XMLHttpRequest to a different domain, where you don't have the access control. Hence the browser is blocking the http request.