Giter Club home page Giter Club logo

ajaxgetcontent's People

Contributors

implico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ajaxgetcontent's Issues

Requests:

Hi, i'm using the plugin in a project, and i have encountered some things that could be enhanced:

  • a method to reset the page (back to home) - clear the content div and reset the location address (e.g., to use in a close button);
  • a function to preprocess the A element before making the ajax load (e.g., to get some attributes from it);
  • a option to load parallel scripts to run according to the page that is being loaded;
  • a extra parameter on 'onReceive' that references the A element clicked (e.g., to change its classname to 'active');

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);

Doesn't work

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.