getting null while trying to send and receive a form value using json and jquery

tiiw

New Member
Here's the HTML part that may be wrong perhaps on the form statement (not sure):\[code\]<div id='data'></div> <form action=""> <input type="text" name="nomeInput" value="" /></form>\[/code\]Here's the javascript part:\[code\]$(document).ready(function(){$.post("testeBasico_1.php", {nomeInput : $('#nomeInput').val()}, function(resposta) { for (var x = 0, tamanhoDados = resposta.dados.length; x < tamanhoDados; x++){ $('#data').append(resposta.dados[x]+'<br>'); } //issue line $('#data').append('<br />'+resposta.venhoDoInput); }, "json");});\[/code\]Here's the php part:\[code\]$response = (object) array( 'success' => TRUE, 'dados' => array("1", "2", "3"), 'venhoDoInput' => $_POST['nomeInput']);echo json_encode($response);\[/code\]When I try this, I get null on 'venhoDoInput' regardless the input field being filled or not.What am I missing here? (it should be something very very basic), I'm just hoping that, by knowing that, I can better understand those evil code lines. Thanks a lot in advance,MEMNote:If I dump($_POST['nomeInput'] on the server side script, I get nothing displayed...that's probably because I'm using js to display that data into the browser.And I'm not quite sure how to debug server side here... :s
 
Back
Top