How can I run ajax code without web server?

Viewed 17962

I am running ajax without a server on my system, I have created one index.html with this.

JavaScript function:

function do_the_click(url)
{
alert('inside this method do_the_click');
    $.ajax({
                         async: false,
                         url : url, 
                         contentType: "text/html",
                         type : "GET",
                         dataType : "text/html",                
                         success: function(data){
                         alert('data');
           }});
} 

My HTML body content is:

<a href="Java Collections.html" class="button" id="javacollections" onclick="do_the_click('this.href');"/>Java Collections</a>

I'm able to get the this message in alert window inside this method do_the_click but am not able to get the data in alert window, and so not able to get the page Java Collections.html in the index.html,

I have searched very much on Google re. how to load the data locally without using server in jquery.ajax but I didn't find any good solution, so I think that its good for others as well if it resides on Stack overflow.

7 Answers
Related