Chevalier85
Chevalier85

Reputation: 1

Load a text file and display in a separate "window"

I'm trying to this. When I click on string "Information Tech" labelled #IT it will load a text file called "InfocommTechnology.TXT" and display it in a window labelled #desc

This is my code.

$(document).ready(function() {"use strict";
  $("#IT").click(function() { 
    $.ajax({
        src : "InfocommTechnology.txt",
        dataType: "text",
        success : function (data) {
            $(".desc").html(data);
        }
    });
  });
}); 

Upvotes: 0

Views: 64

Answers (2)

mplungjan
mplungjan

Reputation: 178011

How about

$(function() {
  $("#IT").click(function() { 
    $(".desc").load("InfocommTechnology.txt");
  });   
});

Upvotes: 1

unconnected
unconnected

Reputation: 1011

Check docs http://api.jquery.com/jquery.ajax/
Use 'url' instead of 'src'.

Upvotes: 0

Related Questions