I want after Ajax success I can pass data from id=use into div id=app.
This is my script:
$.ajax({
type:"post",
url:"process3.php",
data:params,
cache:false,
async:false,
success: function(data){
switch(data){
case 1:
$("#dialog").dialog('close');
$("#segment").show();
$("#appdate").text(today);
$("#app").text($("#use").val());
break;
//case 2:
}
//do next job after success
}
});
But it seems not work. The data can’t show inside the div.
Could you tell me why it’s happen? How to fix that?
This is the html:
<td class="space">
<div id="app"></div><br/>
<div id="appdate"></div>
</td>
<input type="text" id="use" name="use">
server side script:
$sql = "SELECT Privilege FROM admin WHERE user='".$Use."' AND password='".$Pass."'";
echo $sql;
$data=mysql_query($sql) or die(_ERROR26.": ".mysql_error());
if($data){
$priv = mysql_fetch_assoc($sql);
/* will return 1 or 2 depending on the privilage set in you DB where 1 is admin and 2 is user */
echo $priv['privilege'];
}else{
echo 0; // If login fails
}
whether my server side get different result?
I have changed the server side become: