I'm implementing logic to use a url for a query parameter, based on whether the user enters a series of numbers or letters. If the user enters a number, the first urlLocation
should be used, otherwise the second one should be used. Trying to use a regex for the first one, but I'm not sure how to implement that one correctly.
<input id="imageid" type="text" />
if ($("#imageid").val() == '/[^0-9\.]/') {
var urlLocation = "http://www.url.com/rest/v1/cms/story/id/" + imageid.value + "/orientation/" + orientation;
} else {
var urlLocation = "http://www.url.com/rest/v1/cms/story/guid/" + imageid.value + "/orientation/" + orientation;
}
JSFIDDLE EXAMPLE: Link