XMLHttpRequest does not work cross-domain.
-bob
On Jan 23, 2006, at 11:48 AM, Ricardo de Oliveira Saldanha wrote:
I made a workaround (function convert), but the function
MochiKit.DOM.formContents isn´t working for me.
Another thing I have noticed is that if I call this page from
firefox on a
remote machine I got 'undefined' as a response.. Anyone have a clue ?
function dosubmit()
{
var req = MochiKit.Async.getXMLHttpRequest();
req.open(POST,'/home/dologin.ashx',this.async);
req.setRequestHeader(Content-Type,application/x-www-form-
urlencoded;
charset=UTF-8);
alert(MochiKit.DOM.formContents($('dologin')));
// a workaround ;)
var data = queryString(convert($('dologin').elements));
//
var res = MochiKit.Async.sendXMLHttpRequest(req, data);
res.addCallbacks(onSucess,onError));
log('done');
return false;
}
function onSucess(req)
{
var divdest = $('center');
if (divdest)
{
divdest.innerHTML = req.responseText;
}
}
function onError(req)
{
var divdest = $('center');
if (divdest)
{
divdest.innerHTML =req.responseText;
}
log(onError:+keys(req));
log(onError:+req.message);
log(onError:+req.description);
}
html page
--
div id='center' style=margin-top:20%;margin-left:10%;width:200px;
form id=dologin name=dologin
table
tr
tdEmail/td
/tr
tr
tdinput style=width:150px; type=text
name=email id=email/input/td
/tr
tr
td$!{Error_Email}/td
/tr
tr
tdSenha/td
/tr
tr
tdinput style=width:150px; type=password
name=senha id=senha/input/td
/tr
tr
td$!{Error_Senha}/td
/tr
tr
td align=rightinput id=dologinbt
type=button onclick=dosubimit(); value=Entrar /input/td
/tr
/table
/form
/div
-Original Message-
From: mochikit@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf
Of Bob Ippolito
Sent: segunda-feira, 23 de janeiro de 2006 16:54
To: Thomas Hervé
Cc: MochiKit
Subject: [mochikit] Re: formContents
On Jan 23, 2006, at 10:12 AM, Thomas Hervé wrote:
var res = MochiKit.Async.doSimpleXMLHttpRequest
(this.link,formContents('loginform'));
If it's your code, it's normal it doesn't work, or I don't know
what's
this.link : formContents is a function of MochiKit.DOM, not a slot of
nodes.
If it's not your code, please post your real code.
More importantly, post the HTML for loginform.
-bob