I need to build an URL generated from two input fields by the user, writing the final url in the same document (instead of loading the url in a new.window).
I'm coming from this question. Instead of open a new window like in the jsfiddle, I'm trying to print the url generated below the form, with no url text before to click on "Generate". I've tried with serialize(), but doesn't work with the actual code used in the answer.
Here's a non-working example: http://jsfiddle.net/qo027nqd/
HTML
<input id="one"> <input id="two">
<button id="open">Generate</button>
<br /><br />
<b>URL generated prints here, this text is hidden until you click "Generate"</b>
JAVASCRIPT
$('#open').click(function() {
var fixedData1 = 'http://www.myurl.com/#q=',
fixedData2 = '+',
userEntry1 = $('#one').val(),
userEntry2 = $('#two').val();
var newWindow = window.open(fixedData1 + userEntry1 + fixedData2 + userEntry2, '_blank');
newWindow.focus();
});
In this javascript code, I need to change "var newWindow" with something like "document.getElement", "insertText" or something useful.
Thanks in advance!