javascript - How to set the url in off-line site using jquery ajax -
well task running static site, no servers @ all. pure html, , need load , read xml file , update page result.
the task done , can read xml file if file in same location, problem if xml file in separate folder ajax flails. seems url fails.
$.ajax({ type: "get", // working url setting - case - 1 // url: "somexmlfile.xml", // not working - case - 2 url: "../somepath/somexmlfile.xml", datatype: "xml", success: function(xml){ // returned info }, error: function() { // display error } });
case - 1 working solution me, need place xml file in separate place.
then case - 2 way file getting failed.
any idea,
actually no domain, no servers, pure html,
all files in ex:
d:/myfiles/somefolder/index.html
if set file in
d:/myfiles/somefolder/xml/myxml.xml , set url as
url: "xml/myxml.xml"
this config working too,
but i'm trying place xml file in
d:/myfiles/xml/myxml.xml , need read file using ajax setting url
url: "../xml/myxml.xml"
try utilize absolute url:
www.yourdomain.ext/sitedolder/xmlfolder/xmlfile.xml
javascript jquery ajax xml static-site
No comments:
Post a Comment