mysql - Sending data to PHP via $.ajax is not working in every browser -
i know there many related questions one. didn't find question can solve problem or didn't find yet. umm...i using 3 kind of browsers : maxthon 4.4.2.2000 , spark security browser 33.9.2000.3033, , mozilla 32.0.3.
i'm using $.ajax()
send info login form form
<form method="post" id="login_data"> <table> <tr> <td>username</td> <td><input id="txt_user" type="text" name="txt_username"></td> <td><label id="warn_username"></label></td> </tr> <tr> <td>password</td> <td><input id="txt_password" type="password" name="txt_password"></td> <td><label id="warn_password"></label></td> </tr> <tr> <td colspan="1" /> <td><button name="login" id="lgn_button">login</button></td> </tr> </table> </form>
and javascript this:
$(document).ready(function(){ $('#lgn_button').click(function(){ var user = $('#txt_user').val(); var password = $('#txt_password').val(); if(user==""){ alert(''); } else{ $.ajax({ url: 'login.php', type: 'post', data: {username:user,password:password}, success:function(){ } }); } }); });
the lastly 1 php file connected server authenticate user
<?php session_start(); include '../controls/connection.php'; include '../controls/function.php'; shout($_post['username']); open_connection($dbserver,$dbuser,$dbpass,$dbname); $query = mysql_query('select count(user_name) euser user_name="'.$_post['username'].'"'); $count = mysql_fetch_row($query); if($count[0]==0){ } else{ $query = mysql_query('select * euser user_name="'.$_post['username'].'"'); $check=mysql_fetch_assoc($query); if($check['user_password']==md5($_post['password'])){ $_session[md5('user')]=$_post['username']; $_session[md5('author')]=$check['user_authority']; } } ?>
for function : open_connection()
, it's working fine. problem is, code working fine in maxthon browser not in 2 others, why? can explain me? i'm newbie. lot every reply , appreciate it.
php mysql ajax browser compatibility
No comments:
Post a Comment