Am working on a project where i query data from fusion table with ajax. my code is working on all desktop web browsers but does not load data on mobile web browsers. This project is meant for mobile users. Please help.
Here is my code.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>IEBC | Registered Voters</title>
<link href="style/mobile.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
(function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
$('#constituency').change(function(){
$('#mobile-ps-body').html("")
var val = $(this).children("option:selected").val()
var txt = $(this).children("option:selected").text()
getWardList(val)
getTotals('http://vote.iebc.or.ke/ward/?constituency='+txt, "Ward", txt);
});
First things first, and I hate when I have to say this but please use one of the code tags when pasting source code on the forums.
Now, could you please elaborate on what issues you are having with mobile? Which mobile devices have you tested and which of those do not work? I have just successfully run this code on mobile safari (iPhone) with no issues. So this brings me to ask if it is only certain mobile devices (or browsers) with the issue and if so, which ones?
Not every mobile device supports AJAX for starters. Most (if not all) smartphones should support it (with at least one of the available browser apps) but on more basic mobile devices I'd imagine you won't really have much success. I'm not a big jQuery user but as far as AJAX goes, there is not any special way to get it to work on browsers/devices that do not support it initially. At best you would need to implement an iframe trick to give the appearance of AJAX, loading additional data via a hidden frame and then grabbing and displaying that data via javascript. Things like that have been done to get around cross-domain AJAX issues and AJAX form submissions/uploads and should work for a scenario like this, though it's really not a great 'solution' to the problem.
"Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"
Bookmarks