Forums > Jitter

Get Jitter jit.textfile into javascript js

November 19, 2013 | 10:52 am

I’m using jit.uldl to download a long text string from my website. Then I use jit.textfile to view it as text. But now I need to get that text into a js object and I’m having trouble. I used to use jit.str.tosymbol but symbols are limited to 2047 characters. So I need to get the jit.textfile output directly into javascript. Can you please help? I’ve looked everywhere and can’t seem to find any help on this.

I’ve been successful at getting the jitter matrix into javascript, but I don’t know how to look at the text string.


November 19, 2013 | 11:07 am

I suppose one option is to save the jit.textfile as a text file and then reload that into javascript. But is there a direct way to pass jit.textfile to javascript?



Nat
November 19, 2013 | 11:12 am

You could try my mxj utility to download a url:

https://github.com/natcl/max_geturlcontent

this will output the url content and you can pipe directly to js..


November 19, 2013 | 11:32 am

Brilliant! Thank you! I’ll give it a try.


November 19, 2013 | 11:50 am

Nat, would this be possible inside of javascript? So I can just make a GET call directly within javascript and bypass all this extra patching?



Nat
November 19, 2013 | 11:53 am

Sadly I don’t think so, I don’t think we have access to that api from javascript, that’s why I did the java object…


November 19, 2013 | 2:38 pm

Nat, your utility worked for a short string, but when I tried to get a long string (roughly 3000 characters), max just crashes/closes without any warnings or anything. Any idea what that could be about? The string that the website is returning looks similar to the attached file.

Attachments:
  1. string.txt


Nat
November 19, 2013 | 2:43 pm

seems to work here with the attachment, can you share the url of the data ?


November 19, 2013 | 2:57 pm

Ok, so tommymetz.com/test.php is the long one (which crashes max for me) and tommymetz.com/test_short.php is the short one which works. Do they both work for you?

I wonder if it’s some sort of java issue on my end?

Thanks for your help with this btw!



Nat
November 19, 2013 | 3:09 pm

That’s strange, both work for mw here…
what’s your os, max version ?


November 19, 2013 | 3:29 pm

windows 7, max 6.0.7. It’s weird. It just closes max the second I try and parse the url. I’ve had that problem when working with mxj objects in the past. No idea what’s up. I may just have to do multiple jit.uldl calls to get the string in smaller chunks.

Thanks a ton for your help tho. Maybe I’ll try your object on max 6.1 and windows 8. Is there a place I can view some java logs?


Viewing 11 posts - 1 through 11 (of 11 total)