Skip to content

vanpariyar/get-new-quote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get New Quote On Refresh

You can Find This Demo Link Here: https://vanpariyar.github.io/get-new-quote
 getNewQuote = () => {
	function getRandomIntInclusive(min, max) {
		min = Math.ceil(min);
		max = Math.floor(max);
		return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive 
	}
	if(flag == 0){
		$.ajax({
			url: "https://raw.githubusercontent.com/vanpariyar/get-new-quote/master/rendomQuote.json",               
			success: function(result) {
					flag = 1; 
					quotes = JSON.parse(result);
					const quoteNumber = getRandomIntInclusive(0,(quotes.length) - 1);
					$('.qoute').text(quotes[quoteNumber].quote);
					$('.author-name').text(`"${quotes[quoteNumber].author}"`);
					console.log(result);
					}	    	    
		}); 
	}else{
		const quoteNumber = getRandomIntInclusive(0,(quotes.length) - 1);
		$('.qoute').text(quotes[quoteNumber].quote);
		$('.author-name').text(`"${quotes[quoteNumber].author}"`);
		console.log(quotes)
	}
	
}

Ronak Vanpariya

About

This is the Small example of the Api fetch request to the Random Quote API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published