Jquery code to get data from http

I would like to know what can I do to show a list into a html page using jquery.html and $getJson, I have a server.js running on http:localhost:8080/list and I want to show the list between html tags

the html code

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Demo</title>
</head>
<body>
    <a href="http://jquery.com/">jQuery</a>
    <script src="jquery.js"></script>
    <script>

 $.get( "http://localhost:8080/clubs", myCallBack );
    </script>
</body>
</html>

Answers


The myCallBack is where you define a function which can take the data as a parameter.

$.get("http://localhost:8080/clubs", function (data) {
    $("#myDiv").html(data);
});

HTML

<div id="myDiv"></div>

The jQuery Documentation for jQuery.get() includes the following example:

$.get("ajax/test.html", function(data) {
  $(".result").html(data);
  alert("Load was performed.");
});

Need Your Help

FULLTEXT search on a very small column

mysql sql full-text-search sql-like

I have a table Books in my MySQL database which has the columns Title (varchar(255)) and Edition varchar(20)). Example values for these are "Introduction to Microeconomics" and "4".

CodeIgniter – Ban IP and store it into Database and check database

php database codeigniter vote

I’m developing a website using CodeIgniter; I’m making a voting website. The problem is that some of the entries actually let me vote again and again. They keep banning the IP in the database.