Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

JS/HTML Question
show user profile  9krausec
Hey guys.

I've hit a sort of a stupid road block with one of my projects. What I need to do is from an HTML document, splice in a text document at a certain location.

It doesn't need to be a .txt doc, but it needs to be a doc that can hold text that I can pull and splice into a specific spot within my html. Any ideas?

The reasoning behind this is because I'm pushing some stuff out of python and writing it into another text file. Then I want to call that text file in my HTML (it's formatted in python to be pushed out with HTML tags n' the like). Using some Trig math I need out of python.

I've tried a dozen different ways that I've researched online, and it doesn't seem to work. I might be missing something here.

Thanks guys for all the help.

- Portfolio-

read 438 times
12/6/2014 3:29:03 AM (last edit: 12/6/2014 3:29:50 AM)
show user profile  Mr_Stabby
xmlhttprequest can load any file as plain text or xml if its publicly available all though, if you need any kind of back and forth between python and js then you'd have to set up a service in python to chew more complex requests.

PS! js has a perfectly competent math library

read 410 times
12/6/2014 2:37:57 PM (last edit: 12/6/2014 2:37:57 PM)
show user profile  9krausec
^Alright, thanks!

If JS can generate a cosine and sin using changing variable controlled by a while statement with an if/else statement inside then I'm just going to rewrite this in JS.

- Portfolio-

read 404 times
12/6/2014 3:52:57 PM (last edit: 12/6/2014 3:52:57 PM)
show user profile  Mr_Stabby
it most certainly can

read 402 times
12/6/2014 3:57:11 PM (last edit: 12/6/2014 3:57:11 PM)
show user profile  9krausec
Well that's good to know, lol.

I'll rewrite some stuff then. All I'm doing is generating an elliptical (from X/Y Coordinates) per frame in a 360 spin animation as a "path" for some icon to follow.

Exciting stuff indeed.

Thanks Stabbalicious

- Portfolio-

read 400 times
12/6/2014 4:02:02 PM (last edit: 12/6/2014 4:02:14 PM)
show user profile  gogodr
the correct way of doing t his would be to write a web service with python and consume it with your HTML via xmlhttprequest or a more simple Ajax call with JQuery.

To make a web service in python all you need to do is this:

install this:
and your code should be this:

import web

urls = (
'/whaveverYouWantToCallYourService', 'TheFunctionYouWantToCall'

app = web.application(urls, globals())

class TheFunctionYouWantToCall:
def GET(self):
output = "Make Your Login in Here and Then Return the Output as a String, its better if you give it a JSON format."
return output

Then your webservice should be running in localhost:8080/whaveverYouWantToCallYourService


Then you can call that webservice with JQuery.get(theURLHERe) and onsuccess you can do whatever you need to do.

Hello there

beautiful ;3

read 393 times
12/6/2014 6:11:44 PM (last edit: 12/6/2014 6:18:39 PM)
show user profile  9krausec
Thanks for the input Gogodr. I did it all through Javascript and am getting the results I was hoping for! Got a crash course into Javascript and Python the last few days. It feels good to be able to do some light programming again.

Cheers folks!

- Portfolio-

read 387 times
12/6/2014 6:32:44 PM (last edit: 12/6/2014 6:33:29 PM)
show user profile  gogodr
oh, you were using python because you thought Javascript didn't have a Math Library.
Javascript is quite robust, in fact I don't like Python( I know how to program in python, but I dont like it ) for both front end and back end.
Javascript is love, Javascript is life.

Hello there

beautiful ;3

read 382 times
12/6/2014 6:47:26 PM (last edit: 12/6/2014 6:47:26 PM)
show user profile  9krausec
^That's some passion right there, lol.

Yes, I didn't know Javascript had that math lib. Also I'm going to try to start working in Python at every opportunity to strengthen my ability with Maya.

- Portfolio-

read 376 times
12/6/2014 7:27:48 PM (last edit: 12/6/2014 7:27:48 PM)
#Maxforums IRC
Open chat window