javascript - How to upload android and iso app containing mysql / php and wrap with phonegap -
i trying make android , ios app using html, css , passing mysql php through json can use wrap phone gap .
all functions working when tested on browser how can upload app , server side function github repository can build using phone gap cloud. use github repository when develop apps without mysql.
if upload mysql remove server , app github, how link it.
below php connection database
<?php header('access-control-allow-origin: *'); $user="root"; $pass="xxxx"; $dbh = new pdo('mysql:host=localhost;dbname=uxxxmobile', $user, $pass); ?>
here login function '
<script> $(document).ready(function(){ $('#loginform').on('submit',function(e){ var myform = new formdata($(this)[0]); var host = 'http://example.com/uixxxmobile/connections'; $.ajax({ type:'post', url: host + '/login.php', data : new formdata($(this)[0]), cache: false, contenttype:false, processdata: false, beforesend: function(){ $("div#divloading").show(); }, success: function(response){ $("div#divloading").hide(); console.log(response); if(response.success == true) { window.location.href = "profile.html"; } else if( response.success == false ){ alert('please enter correct email & password'); } else if(response.matric =="") { alert('email wrong'); } else if(response.password==""){ alert('password wrong'); } }, error: function(data){ alert('login fail. check login details correctly'); $("div#divloading").hide(); } }); return false; }); }); </script>
and profile function
<script> $(document).ready(function(){ var host = 'http://example.com/uixxxmobile/connections'; $.ajax({ type: 'get', url: host + '/profile.php', data: 'param=no' , datatype: 'json', success: function (response) { console.log(response); var input =""; input +='<b>' + response.name + '</b><br>'; input += response.faculty + '<br>'; input += response.dept + '<br>'; input +=response.school + '<br>'; var cumgrade= response.cumgpa; var currentgrade= response.currentgpa; $('#basiccontent').html(input); $('#cumgpa').html(cumgrade); $('#currentgpa').html(currentgrade); $('#level').html(response.level + ' level ' +response.semester+ ' semester') }, error: function (e){ alert (e); } }); $('#mycourses').load('connections/user-course.php'); }); </script>
you link ajax call. in app, use ajax in jquery:
var host = 'your host address - ex: http://example.com/php/'; $.ajax({ url: host + "/driverlogin.php", type: 'post', cache: false, data: $('#frmdriverlogin').serialize(), success: function(arr) {//handle success}, error: function(){//handle error} });
Comments
Post a Comment