I am trying to run this simple html2canvas code. It work great in Chrome, IE9, Firefox. But is not working in IE8
Code:
html2canvas($(#section), {
onrendered: function (canvas) {
var img = canvas.toDataURL().replace(/^data[:]image\/(png|jpg|jpeg)[;]base64,/i, "");
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Home/SaveDiv",
data: "{'imageData': '" + img + "'}",
dataType: "json",
async: false,
cache: false,
success: function (msg) {
},
error: function (result) {
alert('error');
}
});
}
});
Is there a way I can get it working in IE8. I have heard about flashcanvas which I am not sure on how to use it.
Else, is there any other way I can capture <div> element in IE8.
This is probably because html2canvas requires IE9 or higher, as stated here.
I would recommend using a polyfill: heres a canvas one
Related
This is my simple code to call asmx webservice (xml).
function maxTransaccion() {
$.ajax({
type: "POST",
url: "WebService.asmx/MAxTransaccion",
contentType: "application/json; charset=utf-8",
dataType: "json",
crossDomain: true,
success: function(s) {
return s.d;
}
});
}
But I received this error:
message: "s is not defined"
proto: Error
I am doing something wrong? I use this ajax structure multiple times within a .js file. But only in this function it gives me error, what scares me is that it is so simple
First of all, if your service responds with a XML, then you should adapt for that:
$.ajax({
type: "POST",
url: "WebService.asmx/MAxTransaccion",
dataType: "xml",
crossDomain: true,
success: function(s) {
return s.d;
}
});
I think changing dataType and omitting contentType might do the trick.
The next thing that could be improved is your success-handler.
Check for the property first, before using it:
function(s) {
if (s && s['d']) {
doSomethingWith(s.d);
}
}
But because you are most likely receiving a XML and not a JSON-object, you might want something like this:
function(xml) {
var responseNode = $(xml).find('node');
doSomethingWith(responseNode.text());
}
Also like mentioned in the comments, just returning in an AJAX-call, will probably do nothing. So you need another function, where you get your result and doSomethingWithIt.
Please guide me on how make this javascript code work on mobile device.
I have tested on a desktop browser and its working fine.
But in Android device 4.1.2 can't post submit
$(function () {
$i.ajax ({
type: "POST",
url: web,
crossDomain: true,
data: dataString,
context: document.body,
cache: false,
beforeSend: function(html) {
document.getElementById("hasil").innerHTML = '';
$i(".flash").show();
$i(".flash").html('<div style="float:left;"></div>');
},
success: function(html){
$i("#js_process_request input, #js_process_request select").attr('disabled',false);
$i(".flash").hide();
$i("#hasil").hide();
$i("#hasil").append(html);
}
I have to upload an image onto the ColdFusion server. I have used FormData for the AJAX request to pass image file. It works fine for FF and chrome but gives issues in IE and the form does not get posted.
Is there any alternative way to do so? So that it works fine for FF, Chrome, IE8+.
var formData = new FormData($(obj)[0]);
var actionPage = $(obj).attr('action');
if (validForm) {
$('.mainPage').html('<div style="padding-top:20px;" align="center"><img alt="loading" src="/rpnet/images/ajax-loader.gif" /></div>');
$.ajax({
url: actionPage,
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (returndata) {
$('.mainPage').html(returndata);
}
});
}
return false;
This is the code I have used for posting the form.
I am using the below code snippet to fetch data from a certain webAPI.
data.responseText works fine in FireFox but gives undefined in IE L
I have tried using data.responseJSON also but it doesn’t work in IE.
Please give me the solution to this.
Here is the code which I am using.
$.ajax({
type: "GET",
url: serviceUrl,
contentType: "application/json",
data: "{'slid':'" + slidname + "'}",
async: false,
crossDomain: true,
complete: function (data) {
alert("hii");
alert(data.responseText);
}
});
Which version of the IE? If IE9 or less, the issue could be your jQuery version - see http://jquery.com/browser-support/.
Otherwise, you could try if letting the browser do the formatting of the ajax request data helps:
$.ajax({
type: "GET",
url: serviceUrl,
contentType: "application/json",
data:JSON.stringify( {"slid": slidname} ),
async: false,
crossDomain: true,
complete: function (data) {
alert("hii");
alert(data.responseText);
}
});
If this also fails, you may want to try "jsonp" as dataType for the ajax call since you have a cross-domain request.
$.ajax({
type: "GET",
url: serviceUrl,
contentType: "application/json",
data: JSON.stringify( {"slid": slidname} ),
async: false,
crossDomain: true,
dataType: "jsonp",
complete: function (data) {
alert("hii");
alert(data.responseText);
}
});
I have wrote an jQuery script for my VLC Plugin, that will hold the link from JSON formated code and past it in the plugin for the rtsp link.
But I have a problem.
$.ajax({
type: "GET",
url: "/api/stream",
processData: true,
dataType: 'text',
cache: false,
success: function (data, textStatus, request) {
stream = jQuery.parseJSON(data);
var vlc = vlcEmb;
var link = stream.rtsp;
var rtsp = link;
vlc.playlist.clear();
vlc.playlist.add(rtsp);
vlc.playlist.play();
}
});
here the code, Mozilla Firefox Firebug show me:
uncaught exception: No such method or arguments mismatch.
How can I fix this?