The main objective is to verify that the given SharePoint site URL (which is read through user input) needs to be verified and validated as correct URL before proceeding further. the verification needs to be done using jquery and not through sp.js and sp.runtime.js methods (_spPageContextInfo.webServerRelativeUrl) and not through regex. One of the method could be call a simple ajax call and if it succeeds means site exists so what could be the other method to verify

1 Answer 1


You could use Ajax like this:

<a href="/somelink" id="test1">Link1</a> <span id="result1"></span> $.ajax($("#test1").attr("href"), { statusCode: { 404: function() { $("#result1").html("not working"); }, 200: function() { $("#result1").html("working"); } } });

as used in this related answer on Stack.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.