Guest User

Untitled

a guest
May 25th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. $.ajax({
  2. beforeSend: function(req) {
  3. req.setRequestHeader("Accept", "text/xml");
  4. },
  5. type: "GET",
  6. url: "[proper url]",
  7. contentType: "text/plain; charset=utf-8",
  8. dataType: ($.browser.msie) ? "text" : "xml",
  9. username: '---',
  10. password: '-------',
  11. success: function(data) {
  12. var xml;
  13. if (typeof data == "string") {
  14. alert("Data is string:" + data);
  15. xml = new ActiveXObject("Microsoft.XMLDOM");
  16. xml.async = false;
  17. xml.loadXML(data);
  18. } else {
  19. xml = data;
  20. alert("Data is not string:" + $(xml).text());
  21. }
  22. // Returned data available in object "xml"
  23. //alert("Status is: " + xml.statusText);
  24. $("#ingest_history").html($(xml).text());
  25. }
  26. });
  27.  
  28. setRequestHeader('Accept', '')
  29.  
  30. setRequestHeader('Accept', null)
  31.  
  32. $.ajax({
  33. headers: {
  34. Accept : "text/plain; charset=utf-8",
  35. "Content-Type": "text/plain; charset=utf-8"
  36. }
  37. data: "data",
  38. success : function(response) {
  39. ...
  40. }
  41. })
  42.  
  43. $.ajax({
  44. dataType: ($.browser.msie) ? "text" : "xml",
  45. accepts: {
  46. xml: "text/xml",
  47. text: "text/xml"
  48. }
  49. });
Add Comment
Please, Sign In to add comment