npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

djsonloader

v1.2.0

Published

DJsonLoader is a jquery add-on for loading data in JSON format into forms or other HTML tags, NOW SUPPORTS AJAX and customization.

Downloads

12

Readme

DJsonLoader-jQuery json loader plugin

Version 1.2.0

DJsonLoader is a jquery plugin for loading data in JSON format in forms,select options or other HTML tags, the data can be downloaded whit AJAX(v1.1.0), in addition the data can be loaded in any form field or other tag(input, select, textarea, a, img, p, span, iframe, ul, ol), simply, quickly and flexibly.

It has other features like:

  • JSON data can be downloaded whit AJAX(v1.1.0).
  • Embedded object data can be loaded into other and simple arrays.
  • Reset forms and other HTML containers.
  • Options can be loaded to select tags from simple arrays or objects with multiple configurable options.
  • You can customize data attributes when loading select.
  • You can load all kinds of tags like the src of img, iframe, etc. Or href for links.
  • List elements (ol, ul) can be loaded from simple arrays.
  • Both JSON objects and JSON-formatted strings can be loaded.
  • Data is loaded where the variable matches the name attribute (for form fields), class for any tag or the data-djload attribute in general.
  • Complex objects can be loaded using natural prefix notation (object.key).

Documentation

Git Repository.

Examples

Using the plugin:

		$(container).djload(json,options);

It is invoked on forms, select fields or any other html container (div, nav, section, article, etc.) as a function to be called when needed, it has the following functions: load JSON data in its container, load options from a select , Reset the data of its container and modify the default parameters.

Loading a form, using json data:

		$("#myform").djload(data);

Loading a form, specifying a function that is executed at the end of data loading:

		$("#myform").djload(data,{
			onLoad:function($container){
				$container.find('select').trigger('chosen:updated');
			}
		});
		

Loading a form, resetting the data before loading:

		$("#myform").djload(data,{
			Reset:true,
			imgPrefix: 'assets/images/'
			}
		});
		

The imgPrefix option especify a path for the images.

Example of valid json data:

		var data= {
			firstname:"David",
			lastname:"Jerez",
			age:25,
			sex:"M",
			notify:true,
			obs:"pending certification",
			languages:[1,4,6],
			lastpost:"DJsonLoader!",
			photo:"xjcush2.jpg",
			accessdata:{
				login:"admin",
				password:"123",
				idrole:3
			}
		};

To load data from the object accessdata use prefixes: 'accessdata.login' , 'accessdata.password' Load the options of a select, using data from an array:

		//simple
		var levels='["A","B","C","D"]';
		
		$("#levels").djload(levels);
	
		//object
		var fruits=[{id:1,name:"banana",last:false},
				{id:2,name:"pineapple",last:true},
				{id:3,name:"lemon",last:false}];
				
		$("#fruits").djload(fruits,{
			slabel:'name',
			svalue:'id',
			sselected:'last'
		});

Load html using ajax(v1.1.0):

		$('#ajaxform').djload({},{
    			ajax:true,
    			method: 'get',
    			url:'https://jsonplaceholder.typicode.com/users/1',
    			onError: function(result){
		        	alert('Error on load ajax data!');
    			}
    	});
    	

Load select options using ajax(v1.1.0):

			$('#ajaxselect').djload({},{
    			ajax:true,
    			url:'https://jsonplaceholder.typicode.com/users',
    			svalue:'id',
    			slabel:'name',
    			Adata:[email,phone],
    			onError: function(result){
		        	alert('Error on load ajax data!');
    			}
    		});

You can find html examples on DJsonLoader download.

Author

The DJsonLoader jquery plugin is written by David Esneyder Jerez Garnica. Email

License

Copyright (c) 2023 David Esneyder Jerez Garnica. Released under the GPL v3 license.