(function() {
main();
function main() {
jQuery(document).ready(function($) {
$.ajax({
type: 'post',
url: 'http://example.com/search.php',
data: { value: '123' },
cache: false,
success: function(returndata) {
$('#widget').html(returndata);
}
});
});
}
})();
<script src="http://example.com/widget.js" type="text/javascript"></script>
<div id="widget"></div>
When I paste widget on my site, it works perfectly and I get answers who is in div "widget" but if I paste this:
<script src="http://example.com/widget.js" type="text/javascript"></script>
<div id="widget"></div>
for another page it's not working. Can anyone help?