text: $(document).ready(function(){console.log("ready!"),console.log(red_vars),$(".new-quote").on("click",function(e){e.preventDefault(),console.log("button was clicked"),$.ajax({method:"GET",url:red_vars.rest_url+"wp/v2/posts?filter[orderby]=rand&filter[posts_per_page]=1"}).done(e=>{console.log("This is the result from the endpoint",e),$(".quote").html(e[0].content.rendered),e[0]._qod_quote_source?e[0]._qod_quote_source_url?$(".author").html(e[0].title.rendered+",&nbsp<a href='"+e[0]._qod_quote_source_url+"'>"+e[0]._qod_quote_source+"</a>"):$(".author").html(e[0].title.rendered+", "+e[0]._qod_quote_source):$(".author").html(e[0].title.rendered)}).fail(e=>{$("div.error").html("Oh no "),console.error("An Error Occured with AJAX")})}),$("#submit").on("click",function(e){e.preventDefault();const o=$(".quote-author").val(),t=$(".quote-quote").val(),r=$(".quote-source").val(),n=$(".quote-proof").val();$.ajax({method:"POST",url:red_vars.rest_url+"wp/v2/posts",data:{title:o,content:t,_qod_quote_source:r,_qod_quote_source_url:n},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",red_vars.wpapi_nonce)}}).done(function(e){alert("Success! Thanks for adding to this awesome database of knowlegde")}).fail(function(){alert("Something is wrong here : (")})})});