Problems with Jquery and Javascript SDK of Parse on Safari -
i'm new jquery , parse , don't speak english first of sorry syntax of question. wrote function update artist object on parse.com (updateartist(objectid)). function called when click on save button , works fine on firefox , chrome not on safari.
function updateartist(objectid) { parse.initialize("myid", "myid"); alert(objectid); var artist = parse.object.extend("artist"); var query = new parse.query(artist); query.equalto("objectid", objectid); query.first({ success: function(object) { // retrieved object. $('#createartist').css('visibility', 'hidden'); $('.loadingimage').css('visibility', 'visible'); alert('success'); var name = $("#txtname").val(); var link = $("#txtlink").val(); var desc = $("#txtdesc").val(); var place = $("#txtplace").val(); var latitude = parsefloat($("#txtlat").val()); var longitude = parsefloat($("#txtlong").val()); var eventdate = $('#txtdate').val(); var eventtime = $('#txttime').val(); console.log(eventdate); console.log(eventtime); console.log(name); console.log(link); console.log(place); console.log(desc); console.log(latitude); console.log(longitude); if (eventdate.charat(2)=='/') { var datearray = eventdate.split('/'); var month = datearray[0] - 1; var day = datearray[1]; var year = datearray[2]; } else if (eventdate.charat(2)=='-') { var datearray = eventdate.split('-'); var month = datearray[1] - 1; var day = datearray[0]; var year = datearray[2]; } console.log(month); console.log(day); console.log(year); var timearray = eventtime.split(':'); var finaldate = new date(year, month, day, timearray[0], timearray[1], 0, 0); console.log(timearray); console.log(finaldate); var point = new parse.geopoint(latitude, longitude); console.log(point); var fileuploadcontrol = $("#profilephotofileupload")[0]; if (fileuploadcontrol.files.length > 0) { var file = fileuploadcontrol.files[0]; var photoname = "photo.jpg"; var parsefile = new parse.file(photoname, file); } parsefile.save().then(function(){ object.save(null, { success: function (contact) { alert('secondo success'); contact.set("name", name); contact.set("link", link); contact.set("description", desc); contact.set("place", place); contact.set("geolocation", point); contact.set("eventdate", finaldate); contact.set("image", parsefile); contact.save(); window.location.href = "artist_list.html"; } }); }); }, error: function(error) { alert("error: " + error.code + " " + error.message); } }); }
i'm using safari 6.0.5 , alerts , console.log give me want... i'm totally lost..
when calling "updateartist"? sure wait $(document).ready(function(){…}).
Comments
Post a Comment