scrape data from ao3

scrape data from ao3

const ao3scraper = require(‘ao3scraper’) //replace with your fic, this is just for demo const pageURL = “https://archiveofourown.org/works/35864404” ao3scraper(pageURL).then(ficInfo => { //do something with results }).catch(err => { // This code block will also execute if the link is a 404 console.error(err) }); Here is what the above code is Doing: 1. Require the ao3scraper module…

jquery abort ajax

jquery abort ajax

var xhr = $.ajax({ type: “GET”, url: “https://www.codegrepper.com/myapi.php”, success: function(response){ //do something } }); xhr.abort(); //kill the request Here is what the above code is Doing: 1. We’re creating a new AJAX request using the $.ajax() method. 2. We’re setting the type of request to GET. 3. We’re setting the URL to the API endpoint….

select value from select and pass it to useeffect

select value from select and pass it to useeffect

const GetAPILinks = () => { const [apiData, setApiData] = React.useState([]); const [fetchUrl, setFetchUrl] = React.useState(”); React.useEffect(() => { if (fetchUrl) { fetch(fetchUrl) .then((response) => { return response.json(); }) .then((data) => { setApiData(data); }); } }, [fetchUrl]); return ( {setFetchUrl(e.target.eventKey)}}> Link 1 Link 2 Link 3 ); } Here is what the above code is…

php mysqli connect to two databases pdo

php mysqli connect to two databases pdo

$conn1 = new PDO(“mysql:host=$hostname;dbname=database1”, $username, $password); $conn2 = new PDO(“mysql:host=$hostname;dbname=database1”, $username, $password); $conn1->query(“SELECT * FROM table”); $conn1->query(“SELECT * FROM table”); Here is what the above code is Doing: 1. It’s creating a new PDO object, which is a connection to the database. 2. It’s running a query on the database. 3. It’s running another query…