java - Papa parse working on chrome, not mobile -
i have script thats using papa parse check entry in csv file, redirecting based on if there or not. works fine in chrome on desktop, has few issues on firefox on desktop, , completly doesnt work on chrome browser on android.
<body> <form id="usrform"> <td><label>unique id</label></td> <tr> <td colspan="2"><input class="textbox" id="uniqueid" type="text" maxlength="30" required/></td> </tr> </form> <button onclick="processclick()">proceed</button> </body> <!-- jquery import --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <!-- papa parse csv --> <script src="http://localhost/client/js/papaparse.min.js"></script> <div id="loading" style="background:url(/images/loading.gif) no-repeat center center;width:20px;height:20px; visibility:hidden"> <img src="/images/loading.gif"> </div> <script> // hide loading icon document.getelementbyid("loading").style.visibility = "hidden"; function processclick() { document.getelementbyid("loading").style.visibility = "visible"; if (document.getelementbyid("uniqueid").value == '' ) { alert("please fill in uniqueid field"); document.getelementbyid("loading").style.visibility = "hidden"; } else { parsedata(**client site**/csv/csv.csv", searcharray); } } function parsedata(url, callback) { papa.parse(url, { download: true, dynamictyping: true, complete: function(results) { alert("parsed ready callback"); //callback(results.data); } }); } function searcharray(data) { //data usable here console.log(" searching array"); (a = 0; < data.length; a++) { if (data[a][1] == document.getelementbyid('uniqueid').value) { // redirect var target = "**clientsite**" + document.getelementbyid('uniqueid').value + ".html"; window.location.assign(target); break; } else { console.log(" redirecting on fail"); // redirect failure page } } } </script>
i used alerts see stopped working on mobile, , appears function parsedata(url, callback) { not returning value(whether processing or not cannot tell).
this works on chrome/desktop, confusing part!
i imagine im missing stupid here.
there error didnt catch when uploading testing on local server. working see localhost file, wouldnt else!
Comments
Post a Comment