Hi! I found this function to make a jquery ajax request in an older version of chrome bird. The function looks like this:
ajaxRequest: function(url, callback, context, params, httpMethod) {
if(!httpMethod)
httpMethod = "GET";
var _this = this;
$.ajax({
type: httpMethod,
url: TwitterLib.URLS.BASE + url + ".json",
data: params,
dataType: "json",
timeout: 6000,
beforeSend: function(xhr) {
var auth = $.base64.encode(_this.username + ":" + _this.password);
xhr.setRequestHeader("Authorization", "Basic " + auth);
},
success: function(data, status) {
callback(true, data, status, context);
},
error: function (request, status, error) {
callback(false, null, status, context);
}
});
}
I would need a similar function but which doesn't require authentication.
Could anyone help me by telling where to modify this code. I tried to delete
the beforeSend part but it doesn't work.
Thanks,
Ildi
On Sun, Jan 10, 2010 at 9:58 PM, PhistucK <[email protected]> wrote:
> Make sure you set the domain in the "permissions" section in the manifest.
>
> ☆PhistucK
>
>
> On Sun, Jan 10, 2010 at 12:18, ildi <[email protected]> wrote:
>
>> Hello!
>>
>> I'm trying to develop an extension that retrieves messages from a
>> blog, but I receive a strange error at httprequest. The request is
>> executed because readystate = 4 but the responsetext is empty and
>> status is null. I post my code here:
>>
>> function s1(){
>> var url = "
>> http://www.cirip.ro/php/firefox/mesajev2.php?";
>>
>>
>> url+="user="+document.getElementById("login").value;
>>
>> url+="&pass="+document.getElementById("pass").value;
>>
>> url+="&lang=RO";
>> ajax(url);
>> }
>>
>> var httpRequest = null;
>>
>> function ajax(url){
>>
>> httpRequest = new XMLHttpRequest();
>> httpRequest.open('GET', url, true);
>> httpRequest.onreadystatechange = infoReceived;
>>
>> httpRequest.send('');
>>
>> }
>>
>>
>> function infoReceived(){
>>
>> var output = httpRequest.responseText;
>>
>> if (httpRequest.readyState == 4){
>>
>> document.getElementById("signin").style.visibility = "hidden";
>>
>> document.getElementById("workspace").style.display = "";
>>
>> }
>> }
>>
>> Could anyone tell me what the problem is. The url used by ajax
>> function is corect because if I put it directly in the browser the
>> messages appear. So I really don't have an idea what is the matter
>> with responsetext. Any help is welcome.
>>
>> Thanks!
>>
>> Ildi
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Chromium-extensions" group.
>> To post to this group, send email to [email protected]
>> .
>> To unsubscribe from this group, send email to
>> [email protected]<chromium-extensions%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/chromium-extensions?hl=en.
>>
>>
>>
>>
>
-- You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en.
