jquery ile benim sitenin bir uzak içerik yüklemek için çalışıyorum, ancak sürekli bir hata alıyorum:Uzak bir içeriği jquery ile iletişim kutusuna nasıl yüklerim?
jQuery(function(){
$('#checkout').submit(function(e){
//prevent default behavior and hide possibly existing pop-up
e.preventDefault();
//process request
var form = this;
var url = form.action;
var dialog = $('<div id="lightbox_dialog"></div>').appendTo('body');
// load remote content
dialog.load(
url,
function (response, status, xhr){
dialog.html(response);
});
dialog.dialog();
//prevent the browser to follow the link
return false;
});
});
Ve form kodu: Burada
XMLHttpRequest cannot load 'anylink_here' Origin null is not allowed by Access-Control-Allow-Origin.
benim kodudur
<form id="checkout" action='http://me.me/' method='get'>
<input type="image" class="class1" onclick="this.form.action='http://en.wikipedia.org/wiki/Sample'" title="Title" value="" src="http://4cornersautoloan.com/images/SmallButton.gif">
</form>
Aynı etki alanı için de http: https adresinden yapmam gerekiyor.
Konuyu bakın, inanıyorum: http://stackoverflow.com/questions/4106993/ajax-cross-sub-domain-requests –
ve burada: http://stackoverflow.com/questions/4142779/ json-format-data-from-external-website/4142817 # 4142817 –
ve buradan yardım alabilirsiniz: http://stackoverflow.com/questions/3828982/xmlhttprequest-cannot-load-an-url-with-jquery –