Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. header('Access-Control-Allow-Origin: *');
  4. $report = $_POST['report'];
  5.  
  6. $report_file = fopen("report.txt", "w");
  7. fwrite($report_file, $report);
  8. fclose($report_file);
  9.  
  10. Selenium.prototype.doSaveCopyPaste = function(locator) {
  11. $ = _getGlobalVar('jQuery');
  12. var text = $(locator).text();
  13.  
  14. var formData = new FormData();
  15. formData.append('report', text);
  16.  
  17. $.ajax({
  18. type: 'POST',
  19. url: 'http://copypaste.test',
  20. data: formData,
  21. dataType: 'text',
  22. processData: false,
  23. contentType: false,
  24. success: function(){
  25. alert('Success');
  26. },
  27. error: function() {
  28. alert('failed');
  29. }
  30. });
  31. }
  32.  
  33. command: saveCopyPaste Target: #plain-report Value:
  34.  
  35. var text = $('#plain-report').text();
  36.  
  37. var formData = new FormData();
  38. formData.append('report', text);
  39.  
  40. $.ajax({
  41. type: 'POST',
  42. url: 'http://copypaste.test',
  43. data: formData,
  44. dataType: 'text',
  45. processData: false,
  46. contentType: false,
  47. success: function(){
  48. alert('Success');
  49. },
  50. error: function() {
  51. alert('failed');
  52. }
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement