Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. function updateProfile (){
  2. console.debug("Updating profile");
  3. profile = createProfile(true);
  4. console.debug("Profile collected from web: ", profile);
  5. $.ajax({
  6. type : 'PUT',
  7. url : rootURLGlobal + 'updateProfile/' + $(".active").attr("id") + "/" + profile.name + "/" + roomURL,
  8. dataType : "json", // data type of response
  9. contentType : "application/json",
  10. data : JSON.stringify(profile),
  11. xhrFields : {
  12. withCredentials : true
  13. },
  14. async: false,
  15. success : function(data) {
  16. if (typeof (data) !== "undefined" && data != null) {
  17. if (data.messageType =="Success"){
  18. console.debug("Llamada REST updateProfile/" + profileName + "/" + roomURL, data);
  19. alertify.success("Escena actualizada correctamente.");
  20. initProFileConf();
  21. profileSettingsSaved = true;
  22. }
  23. else {
  24. console.error("Llamada REST updateProfile/: problema en el servidor", data);
  25. alertify.error("Error actualizando la escena");
  26. }
  27. } else{
  28. console.error("Llamada REST updateProfile/: respuesta incorrecta");
  29. alertify.error("Error actualizando la escena"+ data.description);
  30. }
  31. },
  32. error : function(error) {
  33. alertify.error("Error al actualizar el objeto escena");
  34. console.error("Error al actualizar el objeto escena", error);
  35. },
  36. beforeSend : function (data1) {
  37. $("#profileSettings").foggy();
  38. $("#loadProf").show();
  39. },
  40. complete : function (data2) {
  41. $("#loadProf").hide();
  42. $("#profileSettings").foggy(false);
  43. }
  44. });
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement