Fix uploader, ie9 ok, not ie8

This commit is contained in:
Christophe Vilayphiou committed 2012-08-07 17:32:15 +08:00
1 parent 73b2cd1035
commit 8ea7bf75cd
6 files changed
+79 -18

No files matched your search

+41 -5
View File
@@ -1,7 +1,43 @@
$(document).on('click', '#ajax_form_submit', function(){
$('#ajaxForm').ajaxSubmit({
beforeSubmit: function(a,f,o) {
o.dataType = 'script';
}
});
// $('#ajaxForm').ajaxSubmit({
// beforeSubmit: function(a,f,o) {
// o.dataType = 'script';
// if (o.dataType == 'script') {
// o.url = o.url.split('?'); // split on GET params
// if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
// o.url = o.url.join('?'); // join on GET params
// }
// },
// success: function(response,status,xhr){
// alert(response);
// alert(status);
// alert(xhr);
// },
// error:function(){
// alert("error");
// }
// });
var o = {
// dataType: 'script',
dataType: 'html',
url:$("#ajaxForm").attr("action"),
success: function(response,status,xhr){
alert(response);
eval(response);
},
error:function(){
alert("error");
}
}
if (o.dataType == 'script') {
o.url = o.url.split('?'); // split on GET params
if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js
o.url = o.url.join('?'); // join on GET params
}
$('#ajaxForm').ajaxSubmit(o);
});
+1 -1
View File
@@ -47,7 +47,7 @@ function myFileBrowser(field_name, url, type, win) {
var cmsURL = window.location.toString();
cmsURL = cmsURL.split("/");
cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
console.log(cmsURL);
// console.log(cmsURL);
// script URL - use an absolute path!
if (cmsURL.indexOf("?") < 0) {
//add the type as the only query parameter