jquery ajax php results in unidentified index -
when try use ajax-method via jquery receive "unidentified index" message of targeted php file.
the interesting stuff. "debugging" methods console.log() in jquery , firebug network window showing me data sent! seems data doesn't php file. well, when send data usualy way php (post) there no problem. find behaviour (!) strange.
i asked developers know couldn't me problem. maybe (or we) overlooking something?
the php/html form:
<form method="post" action="configurator2.php"> <label>name der navigation</label> <br /> <input type="text" name="menuname" /> <br /> <input class="button" type="button" value="ajax it" /> <input class="button1" type="submit" value="php only" /> </form> <div class="result"></div> <script type="text/javascript"> $(document).ready(function() { $(".button").click(function() { var menuname = $('form input[name=menuname]').val(); $.ajax({ type:'post', url:'configurator2.php', data:{menuname:menuname}, datatype:'html', success:function() { $('.result').load('configurator2.php'); } }); }); }); </script>
and here php:
$name = $_post["menuname"]; echo $name;
load
here fires query server, time without parameters, causing error. actual result received. display on page, use received data:
success:function(data) { $('.result').html(data); }
Comments
Post a Comment