Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

XMLHttpRequest problem

Author Message
dkanze



Joined: 03 Aug 2008
Posts: 1

Posted: Sun Aug 03, 2008 - 6:24 pm    Post subject: XMLHttpRequest problem Reply with quote

I tried many times to make it work, read many info about it (also in this forum) but no progress..
I tried to request site, receive a text. In safari responseText works only with "load_find2", in dashboard widget it's error "NETWORK ERR: XMLHttpRequest Exeption 101". So than in dashboard function "load_find" must work, but it doesn't (it called from input by hiting enter key).
But if in "load_find2" try replace just one line "req.open("GET", url, false);" with "req.open("GET", url, true);" than i can receive responseXML (in dashboard), but i need responseText.

Help me please.

load.js:
Code:

function load_find(evt) {
    var keyCode = evt.keyCode;
   if (13 == keyCode || 3 == keyCode) { // return or enter key
            var ajax_url='http://some.com/';
            var param = document.getElementById("SearchField").value;
            var url = ajax_url+param;
           
            var req = new XMLHttpRequest();
            req.readystatechange = done;
            req.open("GET", url, true);
            req.send(null);
   }
}

function load_find2() {
            var ajax_url='http://some.com/';
            var param = document.getElementById("SearchField").value;
            var url = ajax_url+param;
           
            var req = new XMLHttpRequest();
            req.open("GET", url, false);
            req.send(null);
     
      document.getElementById('Answer').innerHTML = req.responseText;
}

function done() {
      document.getElementById('Answer').innerHTML = req.responseText;
}


Info.plist:
Code:
   
<key>AllowFullAccess</key>
<true/>
<key>AllowNetworkAccess</key>
<true/>
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group