How can I realize old version AJax function?

3 views
Skip to first unread message

wangsuya

unread,
Dec 3, 2008, 6:38:38 PM12/3/08
to MooTools Users
Dear everyone

I try to Ajax by mooTree which was made by mootools1.2.1
and I try to find Ajax in document I did not find. How Can I
realize bellow:

var myjson = new Object();

var b = new String;
var c = new String;
b = '111';
c = 'hikisu';
myjson[c] = b;
var url = "test.php";
var myajax = new Ajax(url,
{method:'post',postBody:Object.toQuerySt
ring(myjson),onComplete:function(mystring){
alert(mystring);
}}).request();


I want to send data to test.php and receive data from test.php.
Old version quite worked,
how to do this in new version?

Thanks by advance.

Wang Suya

nwhite

unread,
Dec 3, 2008, 6:54:52 PM12/3/08
to mootool...@googlegroups.com
try changing 'new Ajax' to 'new Request'

check out the documentation

wangsuya

unread,
Dec 3, 2008, 7:17:57 PM12/3/08
to MooTools Users
I tryed new Request instand of new Ajax but there is error

Object.toQueryString is not a function

How can I realize the function of "Object.toQueryString" in New
version? I read document
do not found how can exchange json data. Could you tell me. Thank you
very much.

Wang Suya
> > Wang Suya- 引用テキストを表示しない -
>
> - 引用テキストを表示 -

wangsuya

unread,
Dec 3, 2008, 7:30:07 PM12/3/08
to MooTools Users
I tryed as bellow

var myjson = new Object();

var b = new String;
var c = new String;
b = '111';
c = 'hikisu';
myjson[c] = b;
var url = "test.php";
var myajax = new Request(url,
{method:'post',onComplete:function(my
string){
alert(mystring);
}});
myajax.send(myjson);

But I get bellow error, Please tell me why? thanks very much.

uncaught exception: [Exception... "Component returned failure code:
0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]"
nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS
frame :: http://ss-proc/~WebTools/mooTree2_r18/dist/mootools/mootools-1.2-core.js
:: anonymous :: line 1842" data: no]

Wang Suya
> > - 引用テキストを表示 -- 引用テキストを表示しない -
>
> - 引用テキストを表示 -

wangsuya

unread,
Dec 3, 2008, 8:13:18 PM12/3/08
to MooTools Users
I tryed Requst.JSON
as bellow

var myjson = new Object();

var b = new String;
var c = new String;
b = '111';
c = 'hikisu';
myjson[c] = b;
var url = "test.php";
var myajax = new Request.JSON(url,
{method:'post',onComplete:functi
on(mystring){
alert(mystring);
}});
myajax.send(myjson);

But bellow error appear
uncaught exception: [Exception... "Component returned failure code:
0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]"
nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS
frame :: http://ss-proc/~WebTools/mooTree2_r18/dist/mootools/mootools-1%5B1%5D.2.1-core.js
:: anonymous :: line 332" data: no]

Who can tell me, what happend? Thank you very much in advance

Wang Suya

electronbender

unread,
Dec 5, 2008, 7:38:37 AM12/5/08
to MooTools Users
Are you trying to get a json from an external url?

On Dec 4, 2:13 am, wangsuya <o-s...@seiss.co.jp> wrote:
> I tryed Requst.JSON
> as bellow
>
> var myjson = new Object();
>
> var b = new String;
> var c = new String;
> b = '111';
> c = 'hikisu';
> myjson[c] = b;
> var url = "test.php";
> var myajax = new Request.JSON(url,
> {method:'post',onComplete:functi
> on(mystring){
> alert(mystring);
> }});
> myajax.send(myjson);
>
> But bellow error appear
> uncaught exception: [Exception... "Component returned failure code:
> 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]"
> nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS
> frame ::http://ss-proc/~WebTools/mooTree2_r18/dist/mootools/mootools-1%5B1%5D...
Reply all
Reply to author
Forward
0 new messages