jquery post
jquery post
Hi,
I am new to jquery and ajax. I have made popup with j query.all things are woking fine. Now I have to get value at my popup from a js function.my popup appears but have no value in post.I came to know that my values are posted to server(from alert in success), but how to retain these value at server so that my popup may show it ?
I have
1)myajax.js
function fwdId(uclk){
$(document).ready(function(){
//alert (uclk+"uclk");
$.ajax({
type: "POST",
url: "update_process.php",
cache: false,
data:"elementId="+uclk,
success: function(resp){
//alert (resp);
//centering with css
ucenterPopup();
//load popup
uloadPopup(resp);//this popup load the update_process.php(this php file has only a form that will populate existing my sql values against the uclk)
}
});
return false;
});
}
2)init.js
.....................
$('#upp').click(function(){
alert("I am in init");
fwdId(uclk); //uclk has number value
});
3)popup(update_process.php)
<?php
include ("../../connections/oConn.php");
include ("../../inc/essential.php");
mysql_select_db($database_oConn,$oConn);
$pid=$_POST['elementId'];
if(isset($_POST['elementId'])){
$sql="select * from tbldpin_tree_elements where id=$pid";
//echo ($sql);
$result=mysql_query($sql);
echo mysql_error();
$result=mysql_fetch_array($result);
}
if(isset($_POST['usave'])){
$sql="update tbldpin_tree_elements set name='$_REQUEST[uname]',descr='$_REQUEST[udescr]',ptitle='$_REQUEST[utitle]',pstatus='$_REQUEST[ustatus]' where id=$pid";
$result=mysql_query($sql,$oConn);
}
if(!$result){
echo mysql_error();
}
else
{
header("Location:./index.php");
}
?>
<form id="up_proc" method="post" action="">
<table id="addp_tbl" width="70%" border="0">
<tr>
<td width="18%"><strong>Processid=<?php echo ("$pid"); echo ("$resp");?> </strong></td>
<td width="81%"> </td>
</tr>
<tr>
<td>Process Name</td>
<td><input name="uname" type="text" id="uname" size="30" value="<?php echo "$result[name]";?>"></td>
</tr>
<tr>
<td>Title </td>
<td><input name="utitle" type="text" id="utitle" size="80" maxlength="100" value="<?php echo "$result[ptitle]";?>"></td>
</tr>
<tr>
<td>Description </td>
<td><label>
<textarea name="udesc" id="udesc" cols="45" rows="5" ><?php echo "$result[descr]";?></textarea>
</label></td>
</tr>
<tr>
<td >Status</td>
<td>
<input name="utitle" type="text" id="utitle" size="80" maxlength="100" value="<?php echo "$result[pstatus]";?>">
</td>
</tr>
<tr>
<td><input type="text" id="res"/></td>
<td><input type="submit" name="usave" value="usave" id="usave" />
<input type="submit" name="exit" value="exit" id="exit" /></td>
<td width="1%"> </td>
</tr>
</table>
</form>