[plugin] JSON (import/export/generate/edit/inspect/...)

Post your work in progress addons and get feedback

Post » Sun Jul 20, 2014 4:46 pm

This plugin looks interesting. Will have to check it out xD. Thx~
B
73
S
10
G
6
Posts: 105
Reputation: 7,577

Post » Sun Jul 20, 2014 7:25 pm

@Dasat
is this working for you?
arithmeticTables.capx
Last edited by Yann on Sun Sep 14, 2014 8:42 pm, edited 1 time in total.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Sun Jul 20, 2014 10:58 pm

@Yann, Thanks a lot, the array illustration made using the plugin very easy and i've been able to implement that in my work. Moving on to the next stage now. Thanks once again.
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Mon Jul 21, 2014 7:16 pm

@Dasat
Glad to help sir
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Mon Jul 21, 2014 7:23 pm

:) shes a miss!!
Yann wrote:@Dasat
Glad to help sir
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Mon Jul 21, 2014 9:19 pm

@Dasat
Indeed, now that you mentionned it, your proceduraly generated robot avatar has a little touch of feminity.
So allow me to rephrase:
Glad to help madam.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Tue Jul 22, 2014 10:31 pm

@Yann, please i'm trying to pass the data in my json object to a database using ajax post, what would be data format be, i used "data="&Json.Asjson(0), but i keep getting error, am I wrong?
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Wed Jul 23, 2014 5:55 pm

@Dasat
Well to debug your problem you have a lot of options:
- you can print the resulting string by inserting the browser plugin and in the action Browser: log(JSON.AsJson(0)) Then you can copy paste the result in http://jsonlint.com/ to see if the json is valid
- you can check if the javascript console gives any error like the famous
XMLHttpRequest cannot load http://scirra.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.google.com' is therefore not allowed access.
whose solution is to either host your game on the same server you are querying, or, make the server send the Access-Control-Allow-Origin: * header
- you can check your own server side code to se if everything is ok

And well, if the problem persist, give more detail.
What would you do if a friend was asking for help on an arithmetic problem without showing you the actual problem? :D (considering you have enough arithmetic knowledge, but that's not the point here)
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Wed Jul 23, 2014 6:55 pm

@Yann, I've handled access origin. I fugured out the problem was with my content type header. Its form instead of Json. I tried using ajax set header to set the content type to app/Jason, but its like its appending it so I get something like content type: xxx-form blabla,application/Json. I posted this on the how do I forum butbim yet to get any help. So my server keeps returning bad request, which implies it knows the data coming is Jason but the header says its form. That is what I need to fix now:the ajax set header action!! Thanks for all the help.
Yann wrote:@Dasat
Well to debug your problem you have a lot of options:
- you can print the resulting string by inserting the browser plugin and in the action Browser: log(JSON.AsJson(0)) Then you can copy paste the result in http://jsonlint.com/ to see if the json is valid
- you can check if the javascript console gives any error like the famous
XMLHttpRequest cannot load http://scirra.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.google.com' is therefore not allowed access.
whose solution is to either host your game on the same server you are querying, or, make the server send the Access-Control-Allow-Origin: * header
- you can check your own server side code to se if everything is ok

And well, if the problem persist, give more detail.
What would you do if a friend was asking for help on an arithmetic problem without showing you the actual problem? :D (considering you have enough arithmetic knowledge, but that's not the point here)
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Wed Jul 23, 2014 8:09 pm

@Dasat
Thing is, I'm not really sure it's required to send json header, since you're basically passing the string in a form variable.

If you're using php on server side, try that:
Code: Select all
<?php
    $data = (isset($_POST['data'])) ? $_POST['data'] : '';
    $json = json_decode(stripslashes($_POST['data']));

    header('Access-Control-Allow-Origin: *'); // for ajax
    header('Content-Type: text/plain');

    echo("raw data:\n");
    var_dump($data);

    echo("\n\n");

    echo("json data:\n");
    var_dump($json);
?>


using this capx JSONtoServer.capx
(don't forget to modify your SERVER_URL)
Last edited by Yann on Sun Sep 14, 2014 8:42 pm, edited 1 time in total.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

PreviousNext

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests