Status 401 when using external Javascript, need a work around -


here facts. have html page calls external javascript file. when load page 401. understand 401 deals authentication, page i'm loading login page. need validate fields, js file not load won't validate fields.

does know causes? or work around?

what http401 unauthorized error. javascript file resides in password-protected folder on server.

if need file in order operate login form, have bring out of protected folder.

in case file externally loaded (that is, not on server), can use xmlhttprequest in order authenticate.

here example using jquery:

$.ajax({    url: /* url */,    datatype: "script",    username: /* username */,    password /* password */:    success: /* success callback function */ }); 

if not want expose username and\or password, i'd suggest storing js file locally on server without authentication.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -