Advertisement
Guest User

Untitled

a guest
Feb 13th, 2013
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <script>
  2. // prepare the form when the DOM is ready
  3. $(document).ready(function() {
  4. var options = {
  5. target: '#rendereduploaed', // target element(s) to be updated with server response
  6. resetForm: true,
  7. clearForm: true,
  8. success: showResponse // post-submit callback
  9. // other available options:
  10. //url: url // override for form's 'action' attribute
  11. //type: type // 'get' or 'post', override for form's 'method' attribute
  12. //dataType: null // 'xml', 'script', or 'json' (expected server response type)
  13. //clearForm: true // clear all form fields after successful submit
  14. //resetForm: true // reset the form after successful submit
  15.  
  16. // $.ajax options can be used here too, for example:
  17. //timeout: 3000
  18. };
  19.  
  20. // bind to the form's submit event
  21. $('#imageupload').submit(function() {
  22. // inside event callbacks 'this' is the DOM element so we first
  23. // wrap it in a jQuery object and then invoke ajaxSubmit
  24. $(this).ajaxSubmit(options);
  25.  
  26. // !!! Important !!!
  27. // always return false to prevent standard browser submit and page navigation
  28. return false;
  29. });
  30. });
  31.  
  32. // pre-submit callback
  33. function showRequest(formData, jqForm, options) {
  34. // formData is an array; here we use $.param to convert it to a string to display it
  35. // but the form plugin does this for you automatically when it submits the data
  36. var queryString = $.param(formData);
  37.  
  38. // jqForm is a jQuery object encapsulating the form element. To access the
  39. // DOM element for the form do this:
  40. // var formElement = jqForm[0];
  41.  
  42. alert('About to submit: \n\n' + queryString);
  43.  
  44. // here we could return false to prevent the form from being submitted;
  45. // returning anything other than false will allow the form submit to continue
  46. return true;
  47. }
  48.  
  49. // post-submit callback
  50. function showResponse(responseText, statusText, xhr, $form) {
  51. // for normal html responses, the first argument to the success callback
  52. // is the XMLHttpRequest object's responseText property
  53.  
  54. // if the ajaxSubmit method was passed an Options Object with the dataType
  55. // property set to 'xml' then the first argument to the success callback
  56. // is the XMLHttpRequest object's responseXML property
  57.  
  58. // if the ajaxSubmit method was passed an Options Object with the dataType
  59. // property set to 'json' then the first argument to the success callback
  60. // is the json data object returned by the server
  61. $('.buttonstyle').css('background-color','<?php echo $col ?>')
  62. $('#purchasebutton').css('background-color','<?php echo $col ?>')
  63. $('#anothermsg').show();
  64. $('#imageupload').hide();
  65. alert('status: ' + completedtext);
  66. if ($('.artwork1').val().length !=0) {
  67. if ($('.artwork2').val().length !=0) {
  68. if ($('.artwork3').val().length !=0) {
  69. if ($('.artwork4').val().length !=0) {
  70. if ($('.artwork5').val().length !=0) {
  71. } else
  72. $('.artwork5').val(filename);
  73. } else
  74. $('.artwork4').val(filename);
  75. } else
  76. $('.artwork3').val(filename);
  77. } else
  78. $('.artwork2').val(filename);
  79. } else
  80. $('.artwork1').val(filename);
  81.  
  82. }
  83.  
  84. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement