Ajax adapter and Json

68 views
Skip to first unread message

Nil Gradisnik

unread,
Oct 5, 2009, 4:02:03 AM10/5/09
to WireIt
Hi, I downloaded WireIt 0.5 and tried ajaxAdapter example, because I
would like to export/import my stage to plain json format in a text
file. If I'm not mistaking this is what this example does.

The problem is that when I open this example in my web browser(firefox
3.5) I get a dialog box with a message:
"Unable to load the wirings: 0 communication failure" and in firefox
javascript error console I see a "syntax error" pointing to a
listWirings.json file which makes no sense. Also I'm unable to save to
json. Save action gives me the same dialog box but with this js error
"not well formed" pointing to fakeSaveDelete.json file.

I didn't change any code from example or other sources. I'd like to
know what am I doing wrong here?

Thanks.


Nil Gradisnik

Nil Gradisnik

unread,
Oct 6, 2009, 5:17:45 AM10/6/09
to WireIt
I've ran this example on a webserver and the dialog message "Unable to
load the wirings: 0 communication failure" is gone.
The listWirings.json is loaded. When I save is says it has been saved
ok, but in the fakeSaveDelete.json there is still the same content.
How can I save to json file?

Eric Abouaf

unread,
Oct 6, 2009, 5:45:51 AM10/6/09
to wir...@googlegroups.com
Hi Nil,

Do you have an idea where your previous error came from ? maybe because you were serving it as a static files (not by a webserver) ?
Anyway, it's gone now :)

For your current issue, I guess you copied the "AjaxAdapter example".
This example doesn't provide save/delete features. They should be implemented in a server-side script.
As you can see in the http://javascript.neyric.com/wireit/examples/ajaxAdapter/ source code,
WireIt.WiringEditor.adapters.Ajax.config
The saveWiring and deleteWiring methods just "GET" the json file.
It's now up to you to integrate those methods in your backend !

(You could use the Google Gears Adapter for testing, it stores the wirings in a local database, which works without backend)

For more informations on adapters, read :

http://javascript.neyric.com/wireit/guide.html#adapters

Regards,

Eric
--
Eric Abouaf
eric....@gmail.com
Tél: 06 29 86 37 89

Nil Gradisnik

unread,
Oct 6, 2009, 8:02:40 AM10/6/09
to WireIt
The previous errors were because I was just opening static html files
in my browser I guess.

I see, I thought the save functionality was provided by this example.
It makes sense now. :)
I've read the guide yes.
But I don't see where can I get the current JSON output of the
WiringEditor?
I just want to save it to a plain text file for a start, that's all.

Thanks for a quick response.

Nil


On Oct 6, 11:45 am, Eric Abouaf <eric.abo...@gmail.com> wrote:
> Hi Nil,
>
> Do you have an idea where your previous error came from ? maybe because you
> were serving it as a static files (not by a webserver) ?
> Anyway, it's gone now :)
>
> For your current issue, I guess you copied the "AjaxAdapter example".
> This example doesn't provide save/delete features. They should be
> implemented in a server-side script.
> As you can see in thehttp://javascript.neyric.com/wireit/examples/ajaxAdapter/source code,
> eric.abo...@gmail.com
Reply all
Reply to author
Forward
0 new messages