I was using the following in an jQuery ajax call just fine with 1.5.1, but since upgrading to jQuery 1.6.2 this globalEval function stops the success function dead in it's tracks. Anybody know why? Or some alternative code that would achieve the same thing?
success: function(data){
...
$(data).filter('script').each(function(){
$.globalEval(this.text || this.textContent || this.innerHTML || '');
});
...
}
Try using 1.6.1. JQuery team noted some Ajax quirks with the latest version and will likely be patching those in 1.6.3
Related
I worked in grails 2.4.7 .Recently i shifted to grails 3.Previously i used grails custom tag for ajax call like remoteFunction, formRemote .This tags are not available for recent version.Can any one tell me the best way of using ajax for recent version .
Yes, from onward 2.4.x g:remoteFunction has been deprecated in grails.
See this. http://docs.grails.org/2.4.1/ref/Tags/remoteFunction.html
Though, you can always use the javascript/jQuery ajax function as below which is exactly does the same thing.
<g:javascript>
function callMyAjax(){
$.ajax({
url:'${g.createLink( controller:'yourcontroller', action:'youraction')}',
data:{
param1:param1,
param2:param2
}
});
}
</g:javascript>
<input type="button" onclick="callMyAjax()"/>
As I could see, ajax-tags has been deprecated due to inefficiency issues. They recomend to use Ajax or native javascript.
Any way, if you still need them, there is a plugin for grails 3 provided as a migration library, but you can use it aswell:
compile 'org.grails.plugins:ajax-tags:1.0.0.RC1'
I have a site running on a localhost that uses different KendoUI grids loaded from a kendoPanelBar. It was all working fine until I updated to OSX 10.9 (Mavericks). Now I can load a grid once using a $.post jquery call, but then the second time I try and load the grid I receive a 412 (Precondition Failed). I have to empty the cache before it will let me load the grid again. The strangest part is that this is only happening in Safari 7.0. Firefox 24.0 is working as normal and can load the grids with no errors.
Is this a problem with my web server configuration that may have changed due to the upload or... could this be just localized to a problem with the new Safari or... is there something that I could be missing in my code that Safari is now strictly checking?
After doing some research I found some information related to cross domain loading that suggested this fix, although since I'm not doing cross domain calls I'm not sure why this actually worked. If someone could explain that would be fantastic.
This is the fix by changing the $.post call to using $.ajax with a GET type and async as false.
Here is the original code:
$.post( "myContent.html" )
.done(function( data ) {
$("#main_content").html(data);
});
Here is the updated code:
$.ajax({
type: "GET",
url: "myContent.html",
success: function(data) {
$("#main_content").html(data);
},
async: false
});
I am working on ASP.NET MVC4 webapi and it seems a put request via $.ajax works fine in case of google chrome and Firefox but it isn't workin in IE(10).
The below code :
$.ajax({
url: 'api/xQuizQuestion',
type: 'PUT',
dataType: 'json',
data: JSON.stringify(AllQsWithAs),
contentType: "application/json;charset=utf-8",
success: function (data) {
alert('Student added Successfully');
},
error: function () {
alert('Student not Added');
}
});
Works fine in chrome/firefox, in sense that the data AllQsWithAs(which is an array of Complex types) gets added to the Request body, but in case of IE(10) the request body is sent without the Data.
Confirmed the same with Fiddler as well.
Surprisingly it works just fine when I change my Browser Mode to IE9/IE8 or Browser mode to IE 8/9.
Not sure whats the issue. Any help/insight would be appreciated.
Seems to be a bug in IE 10.
I'm finding reports that adding this tag to your head will run the scripts in compatibility mode.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >
http://code.gishan.net/code/solution-to-ie10-ajax-problem/
Old bug tracker entry for jQuery closed as can't fix: http://bugs.jquery.com/ticket/12790
I'm having trouble finding a good source, but it may have been fixed in the latest and greatest IE10 release.
I have been sending multiple ajax calls from a single page and trying to load TinyMCE with each ajax call. But TinyMCE loads only the first time.
The code I have been using after AJAX success:
success: function(html) {
$('#showmail').html(html);
$(".mceSimple").each(function(){
tinymce.execCommand('mceRemoveControl',true,'elm1');
tinyMCE.execCommand("mceAddControl",true, 'elm1');
});
Could someone tell me what I am doing wrong
You need to shut down tinymce correctly before reinitializing an editor with the same id a second time.
To shut down an edtor instance use:
tinymce.execCommand('mceRemoveControl',true,'editor_id');
To reinitialize use
tinymce.execCommand('mceAddControl',true,'editor_id');
in XUL environment I tried different method using JQuery such as
$.ajax({
url:'http://www.X-site.com/api/call.php?q=test',
success: function(){alert('success');},
error: function(req,str,e){alert(str)}
});
Not getting any callback.... But the call has been made and received on the X-site. This is a X-Site call.
Posted a similar question using jsonGet
How can I make an AJAX call in XUL env., any other means than jQuery ?
It basically does not work with standard jQuery.
But the XUL documentation tells you how to do it :
here