Cannot receive echo from PHP file via jQuery and AJAX -
i want begin saying sorry asking question because know has been asked lot on here already. i've search through site , used google, , looked @ other examples can't figure out what's wrong. running script firebug running shows post sent nil gets received. i've posted code below.
jquery code:
$('#studio').submit(function (event) { $('#formlaunch').click(); $.ajax({ url: 'test.php', type: 'post', data: { search_var: 'test' }, datatype: 'html', success: function (data) { //$('#result').html(data); alert(data); } }); event.preventdefault(); });
php code:
<?php $term = $_post['search_var']; echo $term; ?>
the end result of code (once ajax request starts working) process sent variables , echo image want displayed in div box on page. starters though trying basic 'shell' work properly.
thanks in advance help or direction.
jeff
always provide error function, when in development. suspect have error response (404, 500, etc). providing error function debugging purposes help see more quickly.
php jquery ajax
No comments:
Post a Comment