Reputation: 500
My android web app doesnt work on click jquery ajax. I don't know what code should i post because .. okay let me tell what i did try. This is link to my web (forum in malays) http://debatremaja.com/mb/cadang_tajuk . and this is app in google play store https://play.google.com/store/apps/details?id=com.debatremaja&hl=en .
Problem + Thumbs up sign in web link above will run
$(".vote_active").click(function(){
var topic_id = $(this).data("topic-id");
var linkto= linktodbcontroller+"insert_vote_by_id_n/"+topic_id;
//window.location.href = linkto;
$(this).next(".sum").load(linkto);
// simple prevent 2nd clicked
$(this).removeClass("clickable");
$(this).css("color","#0c0");
$(this).off("click");
});
And that working fine on
Maybe ajax not working in webview ?
loadUrl("w3school jquery demo") // Sorry, i cannot post more than 2 links
But the button in w3school works fine.
Other avascript works fine. I did set setJavascriptEnable(True) in web app.
Problem only happend on my app webview.
Thanks in advance because i had experiance get my question answered less an hour after posting. Great comunity in stackoverflow.
Edit I use google hosted jquery link. is this the problem? I also use try jquery hosted in same domain (debatremaja.com) but same as before. Doesnt work.
Upvotes: 1
Views: 1757
Reputation: 59
I had the same problem, add this line:
webview.getSettings().setPluginsEnabled(true);
class JsObject {
public String toString() { return "injectedObject"; }
}
webview.addJavascriptInterface(new JsObject(), "injectedObject");
webview.loadUrl(url_webview);
It's in the google's doc
Upvotes: 2