javascript - Testing server's response -


i have form in angular app in user required provide valid url. therefore when submitting form, i'd test if url valid making request url provided , check if server sends 200.

when click submit button, following code run:

$http.get(scope.target_url).success(function(){                 // code              }).error(function(error){                 console.log(error);             }); 

however, never successfull answer: - if provide url like: 'http://www.somesite.com', get:

xmlhttprequest cannot load 'http://www.somesite.com'. received invalid response. origin 'mydomain' therefore not allowed access. 
  • if provide url like: 'http://somesite.com', get:

    xmlhttprequest cannot load http://somesite.com/. no 'access-control-allow-origin' header present on requested resource. origin 'mydomain' therefore not allowed access.

where problem come from?

that normal security constraints. read cors here:

http://en.wikipedia.org/wiki/cross-origin_resource_sharing


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -