Witajcie. Usiłuje przesłać dane jquery ale za chole** mi nie idzie i już powoli się poddaje...

script.js

  1. function send_post_dane(email,kwota,opis,typ_przel,crc,kod_sms){
  2.  
  3. if(email.length > 0 && kwota.length > 0 && opis.length > 0 && typ_przel.length > 0 && crc.length > 0 && kod_sms.length > 0){
  4.  
  5. $.ajax({
  6. url: 'templates/thefrags/str2.php',
  7. type: 'post',
  8. timeout: 30000,
  9. contentType: "application/json; charset=utf-8",
  10. data: { 'tr_email': email,'tr_amount': kwota,'tr_desc': opis,'typ_wys': typ_przel,'crc':crc,'kod_sms':kod_sms},
  11. dataType: "json",
  12. success: function(odebrane)
  13. {
  14. if(odebrane.error.length > 0){
  15. if(odebrane.odpowiedz.length > 0){
  16.  
  17. alert(odebrane.error+"\n"+odebrane.odpowiedz);
  18. }
  19. else
  20. alert(odebrane.error);
  21. }
  22. else{
  23. var answer = "";
  24. var odebrane1 = odebrane.odpowiedz;
  25.  
  26. if(odebrane1.length > 0){
  27. answer += odebrane.odpowiedz;
  28. }
  29.  alert(answer);
  30. }
  31.     },
  32. error: function()
  33. {
  34. alert("Blad ajax -> Skontaktuj sie z administratorem!");
  35. }
  36. });
  37.  
  38. }
  39. else
  40. alert("Wystapil blad!");
  41.  
  42.  
  43. setInterval("location.reload()", 7000);
  44. }


Z reguły wywala ten error.

str2.php
  1. <?php
  2. if(strtolower($_SERVER['REQUEST_METHOD']) == 'post' && isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
  3. $arr = array(); // zwraca dane
  4. $arr['odpowiedz2'] = "";
  5. $arr['odpowiedz'] = "Poszlo";
  6. $arr['error'] = "";
  7.  
  8. echo json_encode($arr);
  9. }
  10. ?>


header z przeglądarki

  1. URL żądania:
  2. xxxxtemplates/thefrags/str2.php
  3.  
  4.  
  5. Metoda żądania:
  6. POST
  7.  
  8.  
  9. Kod stanu:
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16. Nagłówki żądania
  17. 15:08:00.858
  18.  
  19. X-Requested-With:XMLHttpRequestUser-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0Referer:http://xxxxPragma:no-cacheHost:xxx.euContent-Type:application/json; charset=utf-8Content-Length:112Connection:keep-aliveCache-
  20. Control:no-cacheAccept-Language:pl,en-us;q=0.7,en;q=0.3Accept-Encoding:gzip, deflateAccept:application/json, text/javascript, */*; q=0.01
  21.  
  22.  
  23.   Przesłane ciasteczko
  24.   PHPSESSID:40db54513aa67b309b48f8a2098ede7dbbc123e0b2_data:a:2:
  25. {s:11:"autologinid";s:0:"";s:6:"userid";s:1:"2";}bb038dfef1_sid:02ced9d9798490e410a4f62d5c0a2898bb038dfef1_data:a:2:
  26. {s:11:"autologinid";s:33:"118811646950434cfa1d4176.45551522";s:6:"userid";s:1:"2";}bb038dfef1_counter:1bb038dfef12s3:2bb038dfef12hc
  27. 3_c8:1bb038dfef12hc3_c7:1bb038dfef12hc3_c1:1bb038dfef12adm3_3:1bb038dfef1-1s3:1__utmz:118923613.1338632931.1.1.utmcsr__utma:
  28. 118923613.842002358.1338632931.1340726484.1344509148.12__adtaily_ui:PA4PbL9H52__
    adtaily_loc_region:Mazowieckie__adtaily_loc_city:MojeMiasto