Advertisement
Guest User

Untitled

a guest
Jun 20th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?
  2.  
  3. $setType = $_GET["set_type"];
  4. $gender = $_GET["gender"];
  5.  
  6. //$figureSet = file_get_contents($setType . "-" . $gender . ".txt");
  7.  
  8. ?>
  9.  
  10. <html>
  11. <head>
  12.  
  13. <script language="JavaScript">
  14.  
  15. function xmlhttpPost(strURL) {
  16. document.body.innerHTML = '';
  17.  
  18. var xmlHttpReq = false;
  19. // Mozilla/Safari
  20. if (window.XMLHttpRequest) {
  21. xmlHttpReq = new XMLHttpRequest();
  22. if (xmlHttpReq.overrideMimeType) {
  23. xmlHttpReq.overrideMimeType('text/xml');
  24. // See note below about this line
  25. }
  26. // IE
  27. } else if (window.ActiveXObject) { // IE
  28. try {
  29. xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
  30. } catch (e) {
  31. try {
  32. xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  33. } catch (e) {}
  34. }
  35. }
  36. if (!xmlHttpReq) {
  37. alert('ERROR AJAX:( Cannot create an XMLHTTP instance');
  38. return false;
  39. }
  40. xmlHttpReq.open('GET', strURL, true);
  41. xmlHttpReq.onload = function(e) {
  42. var data = JSON.parse(this.response);
  43. }
  44. xmlHttpReq.send();
  45. //xmlHttpReq.responseType = "text";
  46.  
  47. // xmlHttpReq.setRequestHeader('Content-Type', 'application/json');
  48. //xmlHttpReq.onreadystatechange = function() {
  49.  
  50. // callBackFunction(xmlHttpReq);
  51. //};
  52.  
  53. xmlHttpReq.send();
  54. }
  55.  
  56. function callBackFunction(http_request) {
  57. if (http_request.readyState == 4) {
  58. if (http_request.status == 200) {
  59.  
  60. /*var responceString = http_request.responseText;
  61.  
  62. document.body.innerHTML = '';
  63. document.write(responceString);*/
  64. } else {
  65. alert('ERROR: AJAX request status = ' + http_request.status);
  66. }
  67. }
  68. }
  69. </script>
  70. </head>
  71. <body onload="xmlhttpPost('./<? echo $setType . "-" . $gender . ".json" ?>');">
  72. </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement