Simple jquery ajax call to a .txt file

NaN php jQuery Personal

by Start Bootstrap


Here’s the simple ajax call to the text file which would return the content the targeted text fil

Step 1 : Create a new .php and .txt file

Step 2 : In the .php file include the jquery minimal version


 

Step 3 : Introduce a trigger and a result area


 

Get the Result

 

Step 4 : Write a jquery click event

$("#trigger").click(function(){
// ajax call here
});

Step 5 : Place the ajax call over there

$.ajax({url: "demo_test.txt", success: function(result){
$("#result").html(result);
}});

And you’re done !!

Here’s the code that you look for : 

 

Well, i won’t say how to create a text file and put content inside it !!