Can I get a json data from a URL

Hi theres,
For this question, i have a solution: using a dialog.execute_script() + ajax to get a json data, then use the callback function to return the data to Ruby. But this methods need to call the function dialog.show(), otherwise the dialog.execute_script() funtion will not run.

It there any “smarter” methods to get the json data? Or can i run the execute_script() function without dialog.show()?

PS: In mac i can call execute_script() function without dialog.show(), but not for windows

on a PC the webdialog can be set off screen…

john

You could use the Ruby Standard Library as of SketchUp 2014 and use the net/http and json libs.

well good idea, seems a bit cheat :stuck_out_tongue:

Thanks dude.

Yeah, i’m using this methods now, but when i call a net/http function, the program should wait the response of sever, during this time the sketchup will be no response.

Thank you

you would be surprised how many do it…
setting the size to 1px is another ploy…

john