TEST .js
// JavaScript Document
$.post('http://example.com/test.php?image_no='+no_image, function(data) {
$('#gallery').html(data);
});
test.php
<?php
$image_no=$_GET['image_no'];
if($image_no == 1)
echo '<img src="http://example.com/thumb/1.jpg" />';
else
echo '<img src="http://example.com/images/2.jpg" />';
?>
These are The two Files.
When I Call This Below code In A Another Domain . its Not working
<div id="gallery" ></div>
<script type="text/javascript">no_image=1;</script>
<script type="application/javascript" src="http://example.com/rajeshtest/rajesh.js" ></script>
This is The Error
XMLHttpRequest cannot load
. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers.
Please suggest A Solution..