tags:

views:

93

answers:

3

I Have to load a html file using jquery. When i referred google, i got the snippet

$("#feeds").load("feeds.html");

But I dont want to load the content of feed.html into feeds object. Instead I need to load that page entirely. How to load that page. Help me plz

A: 

$.get()

Here's a summary:

Load a remote page using an HTTP GET request. This is an easy way to send a simple GET request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code). If you need to have both error and success callbacks, you may want to use $.ajax.

$.get() returns the XMLHttpRequest that it creates. In most cases you won't need that object to manipulate directly, but it is available if you need to abort the request manually.

Ngu Soon Hui
+4  A: 

If you're not wanting to load() some HTML into an element on the existing page, maybe you mean that you want to redirect to another page?

url = "feeds.html";
window.location = url;

Or maybe you just want to fill an entire body? You could load() into the body tag if you wanted.

$("body").load("feeds.html");
jjclarkson
A: 

Are you sure feeds.html is located under the same domain as your script?
If so, that line is ok, you'll search for problem anywhere else. Try to debug it with Firebug under Net panel.
If not, so you are able to send only JSON requests to urls under other domains. But you can easily write a proxy script with PHP (noticed php tag under your question :) ) to load your content with cURL. Take a look at CatsWhoCode tutorial at point 9, hope it'll help.

Mushex Antaranian