• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jQuery load operation problems

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone !

Now, I'm learning the Jquery lesson , but I encountered a few problems while working with it

specific, this is my code called jquerydemo.jsp and demo_test.txt file , when I click <button>Get External Content</button> it will display the content in demo_test.txt file , but it don't display content. . however if I replace $("#div1").load("demo_test.txt") by alert("Hello world!") it display "hello world ", please show me !how to resolve this code

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that the JavaScript debugger is open in your browser and observe if the Ajax request is succeeding. I'm betting that it is not.

The URL that you are using should be server-relative, beginning with the context path. Using a page-relative URL as you are doing here is fraught with perils even if you do get it to work.
reply
    Bookmark Topic Watch Topic
  • New Topic