Witajcie. Usiłuje przesłać dane jquery ale za chole** mi nie idzie i już powoli się poddaje...
script.js
function send_post_dane(email,kwota,opis,typ_przel,crc,kod_sms){
if(email.length > 0 && kwota.length > 0 && opis.length > 0 && typ_przel.length > 0 && crc.length > 0 && kod_sms.length > 0){
$.ajax({
url: 'templates/thefrags/str2.php',
type: 'post',
timeout: 30000,
contentType: "application/json; charset=utf-8",
data: { 'tr_email': email,'tr_amount': kwota,'tr_desc': opis,'typ_wys': typ_przel,'crc':crc,'kod_sms':kod_sms},
dataType: "json",
success: function(odebrane)
{
if(odebrane.error.length > 0){
if(odebrane.odpowiedz.length > 0){
alert(odebrane.error+"\n"+odebrane.odpowiedz);
}
else
alert(odebrane.error);
}
else{
var answer = "";
var odebrane1 = odebrane.odpowiedz;
if(odebrane1.length > 0){
answer += odebrane.odpowiedz;
}
alert(answer);
}
},
error: function()
{
alert("Blad ajax -> Skontaktuj sie z administratorem!");
}
});
}
else
alert("Wystapil blad!");
setInterval("location.reload()", 7000);
}
Z reguły wywala ten error.
str2.php
<?php
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post' && isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { $arr = array(); // zwraca dane $arr['odpowiedz2'] = "";
$arr['odpowiedz'] = "Poszlo";
$arr['error'] = "";
}
?>
header z przeglądarki
URL żądania:
xxxxtemplates/thefrags/str2.php
Metoda żądania:
POST
Kod stanu:
Nagłówki żądania
15:08:00.858
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-
Control:no-cacheAccept-Language:pl,en-us;q=0.7,en;q=0.3Accept-Encoding:gzip, deflateAccept:application/json, text/javascript, */*; q=0.01
Przesłane ciasteczko
PHPSESSID:40db54513aa67b309b48f8a2098ede7dbbc123e0b2_data:a:2:
{s:11:"autologinid";s:0:"";s:6:"userid";s:1:"2";}bb038dfef1_sid:02ced9d9798490e410a4f62d5c0a2898bb038dfef1_data:a:2:
{s:11:"autologinid";s:33:"118811646950434cfa1d4176.45551522";s:6:"userid";s:1:"2";}bb038dfef1_counter:1bb038dfef12s3:2bb038dfef12hc
3_c8:1bb038dfef12hc3_c7:1bb038dfef12hc3_c1:1bb038dfef12adm3_3:1bb038dfef1-1s3:1__utmz:118923613.1338632931.1.1.utmcsr__utma:
118923613.842002358.1338632931.1340726484.1344509148.12__adtaily_ui:PA4PbL9H52__
adtaily_loc_region:Mazowieckie__adtaily_loc_city:MojeMiasto
Ten post edytował dram 2.09.2012, 14:11:28