-
-
Save dmolsen/1282062 to your computer and use it in GitHub Desktop.
$.ajax({ | |
url: "test.html", | |
dataType: 'xml', | |
success: function (data) { | |
$('#cancelPayment',data).attr('bar','element'); | |
var str = (new XMLSerializer()).serializeToString(data); | |
$('#appDiv').html(str).trigger('create'); | |
} | |
}); |
It appears that I'm getting errors because it's expecting xml data?
I set up a test page here (Fail) > https://www.1stbankofcolorado.com/mobile/XMLSerializerTest.html
This page passes just using regular ajax call, but without adding the attributes > https://www.1stbankofcolorado.com/mobile/XMLSerializerTest-Pass.html
Note: The java developer is returning raw html in my case.
So it turns out that using the 'xml' feature, the return data(html) has to be clean with proper closing tags and whatnot. Once I more properly formatted the html, it works! Huge thanx for your help. To some it might not seem like such a big deal to de-emphasize the cancel button, but to me it's huge and it makes a clearer path to completion, give the user a better UX and increases conversion.
Because I have no control over what the Java Developer is giving me (i.e.broken html), I ended up with a different solution:
$.ajax({
type: "POST",
url: url,
data: paymentStr,
success: function(data) {
var dataStorage = $(bpm.remoteAppDivName).html(data);
$('#cancelPayment').attr('data-theme','d')
dataStorage.trigger('create');
}
});
Though I would share this with you. Thanx again!
Here's what I got. Does the dataType have to be XML? I'm not getting errors, but the ajax loading graphic just hangs.
The Cancel Payment element is an input type="submit"
$.ajax({
type: "POST",
url: url,
dataType: 'xml',
data: paymentStr,
success: function(data) {
$.mobile.hidePageLoadingMsg();
$('#cancelPayment',data).attr('data-theme','d');
var str = (new XMLSerializer()).serializeToString(data);
$(bpm.remoteAppDivName).html(str).trigger('create');
}
});