javascript - When I get data with ajax I cant Post it -
product.php
function getdata(getdatafrom, resultclass){ $.get(getdatafrom, function(data) { $(resultclass).html(data); }); } getdata('get.php?action=porsiyondurum2&id=<?php echo $urunid; ?>','#porsiyondurum2');
get.php
$action = htmlspecialchars(mysql_real_escape_string($_get['action'])); if($action=="porsiyondurum2"){ $id = htmlspecialchars(mysql_real_escape_string($_get['id'])); $urunporkont = mysql_query("select * porsiyon urunid='$id'"); $urunporkonts = mysql_num_rows($urunporkont); while($urunporkontv = mysql_fetch_array($urunporkont)){ $porid = $urunporkontv['id']; $porname = $urunporkontv['name']; $porucret = $urunporkontv['ucret']; echo '<tr><form action="post.php?action=porguncelle&id='.$porid.'" method="post" target="frame'.$porid.'"><td><input name="porname" type="text" class="form-control" placeholder="'.$porname.'" value="'.$porname.'"></td><td><div class="input-group"> <input type="number" name="porucret" class="form-control" min="0" placeholder="'.$porucret.'" value="'.$porucret.'"> <span class="input-group-addon">₺</span> </div></td><td class="text-center"><iframe name="frame'.$porid.'" src="not_submitted_yet.php" ></iframe><button class="btn btn-primary btn-sm" onclick="test()" type="submit"><i class="fa fa-edit"></i> güncelle</button> <button class="btn btn-danger btn-sm" ><i class="fa fa-trash"></i> sil</button></td></form></tr>'; } echo '<tr><td><input type="text" class="form-control" placeholder="porsiyon adı"></td><td><div class="input-group"> <input type="number" class="form-control" min="0" placeholder="Ücret"> <span class="input-group-addon">₺</span> </div></td><td class="text-center"><button class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> yeni ekle</button></td></tr>'; }
as can see. can see get.php codes @ product.php. when trying frame post it. doesnt work. or tried ajaxpost didnt happened also. when copy code product.php posts perfectly. how can this?
edited: guys not php problem. wrote related part on get.php
$action
not defined (per code you've provided), initial condition entire get.php
script relies on, fails.
if($action=="porsiyondurum2"){
because it's being passed in get
querystring, need handle in manner, other values being passed:
if($_get['action'] == "porsiyondurum2"){
see how got id doing that: $_get['id']
. same applies action.
in addition
i don't see you're connecting database in get.php
, either. there more script you've posted here? if so, please add post , remove answer (unless resolves problem).
Comments
Post a Comment