Code Monkey home page Code Monkey logo

Comments (4)

markserbol avatar markserbol commented on September 27, 2024

Urlive does not come with user input handling in a <textarea> or <input>. But it has callback functions that you can use and execute your custom handling in a given instance.

This is the user input handling code in the <textarea> demo page.

$('textarea').on('input propertychange', function () {
     $('textarea').urlive({
        callbacks: {
            onStart: function () {
                $('.loading').show();
                $('.urlive-container').urlive('remove');
            },
            onSuccess: function (data) {
                $('.loading').hide();
                $('.urlive-container').urlive('remove');
            },
            noData: function () {
                $('.loading').hide();
                $('.urlive-container').urlive('remove');
            }
        }
    });
}).trigger('input');

It's pretty straightforward. On the start of the AJAX request you can show your loading sign and remove the current url preview. And when the AJAX returns with success, the new url preview will be rendered and so you need to hide your loading sign. However when it returns with no data you need to remove the current url preview and hide loading sign. You can also make use of onFail() callback just in case the AJAX request fails.

from urlive.

markserbol avatar markserbol commented on September 27, 2024

I found something. It's throwing the error before executing the callback function noData().

I will push an update.

from urlive.

markserbol avatar markserbol commented on September 27, 2024

It's now fixed please get the new update. Cheers!

from urlive.

YoungsoonLee avatar YoungsoonLee commented on September 27, 2024

oh~...thank you very much~!

from urlive.

Related Issues (20)

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.