1

I use loadDataWithBaseURL to open webView on Android.

wv1.loadDataWithBaseURL("file:///android_asset/", htmlString, "text/html", "utf-8", null);

in that htmlString. I try to open ajax with responseText, but it's not working. the javascript in the htmlString is like following...

function fucMiniDic(strKey){
    var tarDiv = document.getElementById('divMiniDic');
    tarDiv.style['visibility'] = 'visible';

    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (xhttp.readyState == 4 && xhttp.status == 200) {
            tarDiv.innerText = xhttp.responseText;
        }
    };
    xhttp.open('GET', 'http://myWebSite/page.aspx?strkey='+strKey, true);
    xhttp.send();
}

by huge google searching... I slightly understand that 'http://myWebSite' is considering a folder in the asset of android, not like world-wide-web domain. because I use loadDataWithBaseURL to open webview.

so... my question is how I can get the responseText from ajax of world-wide-web, escaping from the folder of assets in Android?

When I test the ajax code on PC, it's fine to run. so, I think there is no syntax error in my code. The only problem is the approch to the ajax on the Android.

김도형
  • 31
  • 6

1 Answers1

0

I found simple way to run it.

wv1.loadDataWithBaseURL("http://yourWebSite/", htmlString, "text/html", "utf-8", null);

just need to chang the root folder to the website from local asset folder...

-_-;;;

김도형
  • 31
  • 6