I have a problem about my project. I make it in two part: On host server by php and On mobile and I want to include all in one project. How should I do that?
I want to send data to php by ajax and I did the following :
I have this javascript :
<script type="text/javascript">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
$("#button").click(function(evt){
var txtUsername = $("#txtUsername").val();
var txtPassword1 = $("#txtPassword1").val();
var senddata ={'txtUsername' : txtUsername,'txtPassword1':txtPassword1};
$.ajax({
type: 'POST',
data: senddata,
url: 'http://(Domain_name)/a_project/file/check_login.php',
cache: false,
success: function(data) {
alert('Your comment was successfully added');
},
error: function(){
alert('There was an error adding your comment');
}
});
return false;
});
}
</script>
HTML code :
<form method="post" data-ajax="false">
<label for="user">ชื่อผู้ใช้ : </label>
<input type="text" data-clear-btn="true" name="txtUsername" id="txtUsername" data-theme="a">
<label for="pass">รหัสผ่าน :</label>
<input type="password" data-clear-btn="true" name="txtPassword1" id="txtPassword1" data-theme="a">
<table align="center" width="100%">
<tr >
<td width="50%"><input type="button" id="button" value="เข้าสู่ระบบ" data-theme="g" ></td>
<td width="50%"><a href="#popupForgot" data-rel="popup" data-position-to="window" data-role="button" data-theme="g">ลืมรหัสผ่าน</a></td> </tr>
</table>
<a href="#popupRegis" data-rel="popup" data-position-to="window" data-role="button" data-theme="g">สมัครสมาชิก</a>
php code :
<?
$txtUsername =$_POST['txtUsername'];
$txtPassword1 =$_POST['txtPassword1'];
include("connect.php");
$strSQL = "SELECT * FROM login WHERE username = '".$txtUsername."'
and password = '".$txtPassword1."'";
.
.
.
.
.
?>
Well, it looks like the data can't send to php. what should i do?
THANK YOU