implico / ajaxgetcontent Goto Github PK
View Code? Open in Web Editor NEWAjaxGetContent - dynamic AJAX website
License: MIT License
AjaxGetContent - dynamic AJAX website
License: MIT License
Hi, i'm using the plugin in a project, and i have encountered some things that could be enhanced:
I've also hado to modify the line 248, to allow it to recognize the links, otherwise it would treat as an ordinary link (going directly thru the page, not loading it dinamically):
var invalidUrl = /(href.substr(0,1) != '/') ||/ (href.indexOf('#') >= 0);
I can't get the plugin working with a simple demo
here's my index.html
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="scripts/jquery.ba-bbq.min.js"></script>
<script src="scripts/jquery.ajaxGetContent.js"></script>
<script src="scripts/main.js"></script>
</head>
<body>
<p><span>simple content</span> <a href="test.html">here</a></p>
</body>
</html>
here's test.html
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="scripts/jquery.ba-bbq.min.js"></script>
<script src="scripts/jquery.ajaxGetContent.js"></script>
<script src="scripts/main.js"></script>
<span>new content</span>
and here's main.js:
$(function()
{
console.log("init")
$('a').ajaxGetContent( {
onSend : function(url)
{
alert("sending")
//set low opacity for content while AJAX call is performed
$('p').css('opacity', 0.5);
},
onReceive : function(data, status)
{
alert("receiving")
data = $(data);
if (status == 'success')
{
//insertion of fetched content
$('span').html(data);
}
});
});
There's neither alerts nor errors when I try to click the link, test.html is simply loading without ajax.
I'm trying to run this example on a yeoman local webserver. What am i doing wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.