0

I'm trying to learn more about javascript and I've been checking out some code from companies like olark which includes a messaging system on your site.

One thing that I noticed is that when you install their software on your server is that it's just a simple copy/paste of some javascript and then you have a styled window on whatever page it's installed. This has to mean that some HTML/CSS is returned, right?

My question is, how can you go about using javascript and having a form returned or referenced, such as knockout.js? For example, in the most simple sense, say I have the following HTML page. Can I use a <script> tag to call to my server which will return a form?

//page1.html
<body>
    ...some html here
    <script> function call which will return a knockout.js form/table/whatever along with referencing the file containing the viewmodel</script>
</body>

From what I understand anything in a <script> tag is not affected by the same origin policy. Does this mean I can potentially use javascript to call for an external knockout.js form?

1 Answer 1

2

Using like this script type="javascript/text" src="your javascript knockout.js path" define your path of knockout.js in src in script tag and you can access the function from your knockout.js.

Sign up to request clarification or add additional context in comments.

4 Comments

I understand that, but how about actually returning HTML? I guess what I'm asking is how can I return a textbox and submit button from a js file?
if you are use simple javascript than you can't return text box, but if using jQuery you may return textbox.
Is there some kind of form builder that I can use for jQuery?
It may be available i always use notepad++ for form builder and js. so find it from google.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.