jQuery kategorisi arşivi

jquery tarayıcı motorunu öğrenme

Bazı durumlarda , genelde tasarım ile ilgili konularda, kullanıcının browser’ına göre değişik gereksinimler oluşabilmektedir.
Bu özellikle internet explorer ile çok sıkça yaşanmaktadır. Bu sebeple browser bilgisini öğrenip buna göre işlem yaptıran bir çok css html veya javascript örneği bulabiliriz.

Yine de küçük bir örnek de biz verecek olursak ;

head taglarımızın arasında

< script src="http://code.jquery.com/jquery-latest.js">

yazıp jquery’yi include edelim.

Aşağıdaki kısmı body tagları arasına yerleştirirseniz, kod hatasız çalışacaktır.

< script>
    jQuery.each(jQuery.browser, function(i, val) {
      jQuery("
" + i + " : " + val +"").appendTo( document.body ); }); jQuery('Browser Ana Versiyonu : '+parseInt(jQuery.browser.version, 10)+'').appendTo(document.body); //jQuery('Browser Ana Versiyon : '+parseInt(jQuery.browser.version, 10)).appendTo(document.body); if ($.browser.webkit) { jQuery('Browser Webkit desteklemektedir.').appendTo(document.body); }else{ jQuery('Browser Webkit desteklememektedir.').appendTo(document.body); } < /script> Veya aynısı $. diye yazılan hali < script> $.each($.browser, function(i, val) { $("
" + i + " : " + val + "").appendTo( document.body ); }); $('Browser Ana Versiyonu : '+parseInt($.browser.version, 10)+'').appendTo(document.body); if ($.browser.webkit) { $('Browser Webkit desteklemektedir.').appendTo(document.body); }else{ $('Browser Webkit desteklememektedir.').appendTo(document.body); } < /script>

Not : Chrome için safari : true diye bir sonuç alınmakta. Bu noktada sizi jquerynin kendi sayfasına davet ediyorum, buyrunuz.

, , , ,

Yorum yok

jQuery, AJAX and Internet Explorer

The issue:

Internet Explorer won’t parse XML quite as easily as every other browser on the internet (I assume). You have to change what you pass it as through jQuery. In IE it has to be passed as text, while the rest can handle it as XML. You also have to pass it through a separate function that brings in ActiveX before you can navigate your way through the XML and use it in your application.

The solution:

Set the type to “text” for IE and “xml” for the rest.

dataType: ($.browser.msie) ? "text" : "xml"

Use a function to “fix” the XML for IE

function parseXml(xml) {
 if (jQuery.browser.msie) {
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.loadXML(xml);
    xml = xmlDoc;

    }

 return xml;
}

Reference the function in your .ajax()

success: function(xml) {

var newXML = parseXml(xml);

$(newXML).find()....

here we go!

Yorum yok

jquery.post internet explorer hata (error)

I want to make an ajax request to the URL which I am currently in. For that reason, I did not write the URL again and assign there “”.

But in internet explorer 9, if you make that empty like me, IE9 gives an error in jquery.js in line blabla.. (at the beginnig of the code, x=open(….. )

//the wrong one
jQuery.post("",{"AjaxRequest":1 ,"defaultParams":defaultParams,"searchParams":searchParams},function(responseText,status,response){
    //success doSomething
}

So rewrite your wrong code like this,

//the right one
jQuery.post("http://write.down.your.url.here?with=params",{"AjaxRequest":1 ,"defaultParams":defaultParams,"searchParams":searchParams},function(responseText,status,response){
    //success doSomething
}

That resolved my problem.
Some other errors can raise, but here it is not the post to write solutiouns to the other failures.

, , , , ,

Yorum yok