ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Input user data to complete URL using only HTML

<< < (2/2)

Shades:
Us poor Yanks only get
 INAUGURATION DAY! 
-questorfla (January 19, 2017, 11:06 AM)
--- End quote ---

Za vashe zdorov’ye!  or should I say:   ваше здоровье?

Yep...to the basement we go!  :P

4wd:
Regarding the testing to see if the destination is valid before redirecting to it - below is what I've tried to work out from information on jQuery but I've obviously got something wrong since it doesn't seem to work.

Anyone knowledgeable in jQuery able to fix what seems to me to be a simple problem?


--- Code: HTML5 ---<HTML>  <HEAD>    <SCRIPT src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></SCRIPT>    <SCRIPT src="urlExists.js"></script>    <SCRIPT LANGUAGE="JavaScript">      function goToPage(form) {        var initial = "https://www.oracle.com/"        var extension = "/index.html";        var newurl = initial + form.subpage.value + extension;        alert(newurl);        urlExists(newurl, function(exists){          alert(exists);          if (exists) {            alert('URI exists');            window.location.assign(newurl);          } else {            alert("URI doesn't exist");          }        });      }    </SCRIPT>    <TITLE>Redirect Test</TITLE>  </HEAD>  <div style="margin-right:auto;margin-left:auto;width:600px;height:120px;border:10px solid #212189;">  <BODY>    <P><br>    <FORM name="form" action="" method="GET">      &emsp;&emsp;&emsp;Type Code Word Into Box - Click GO:       <INPUT type="text" name="subpage" value="">      <INPUT type="button" Name="button" value="GO" onClick="goToPage(this.form);">    </FORM>  </BODY></HTML></div>

--- Code: Javascript ---/* urlExists.js https://stackoverflow.com/questions/4301968/checking-a-url-in-jquery-javascript */function urlExists(url, callback){  $.ajax({    type: 'HEAD',    url: url,    success: function(){      callback(true);    },    error: function() {      callback(false);    }  });}
Or is it a problem with cross domain request restrictions?

Navigation

[0] Message Index

[*] Previous page

Go to full version