This code is returning blank array. I am posting to PHP script with code.
PHP:
<?php
var_dump($_REQUEST);
?>
Jquery Code:
jQuery(document).ready(function($) {
// --------------------------------------------------------------
// Submit danasnji dan
// --------------------------------------------------------------
$("a#danasnji-submit").click(function(event){
event.preventDefault();
var lokacija = $("input#base-url").val()+"/uporabnik/umakniRezervacije";
var podatki = $("table#danasnji-dan tbody tr.clicked");
var izbrano = new Array();
if(confirm("Ali ste prepričani?")){
podatki.each(function(){
izbrano.push($(this).data());
});
$.ajax({
type : 'POST',
url : lokacija,
data : izbrano,
success : function(vrnjeno){
alert(vrnjeno);
$("table#danasnji-dan tbody tr.clicked").each(function(){
$(this).fadeOut();
});
}
});
}
});
});
What am I doing wrong. Please, any ideas?
Okay, I’ve found the problem. Since I was posting to PHP, the script had to retrieve that value by name. You can’t just post a value withou variable holding it.
So, the solution is this. Key value pair
Thanks for your help anyway,
cheers