Category : ajax

I’m starting to develop a website using HTML in frontend and PHP at backend. But, I have a question. Should I use (with index.html): <select id="select"></select> <script src="js/jquery.js"></script> <script> $(document).ready(() => { $.ajax(‘api/getUsers.php’, { method: ‘GET’ }, success: (retrievedData) => { functionToFillSelect(retrievedData) }) } </script> Or… I should use (with index.php): <?php $users = getUsersFromDatabase(); ..

Read more

<div class=’modal fade collabform’id=’collabrequest".$useremail."".$postid."’ tabindex=’-1′ role=’dialog’ aria-labelledby=’Title’ aria-hidden=’true’> <div class=’modal-dialog modal-dialog-centered’ role=’document’> <div class=’modal-content’> <div class=’modal-header’> <h5 class=’modal-title’ id=’Title’>Collab</h5> <button type=’button’ class=’close’ data-dismiss=’modal’ aria-label=’Close’> <span aria-hidden=’true’>&times;</span> </button> </div> <div class=’modal-body’> <form method=’POST’ action=” id=’collabForm’ > <textarea rows=’3′ class=’form-control’ name=’collab_message’ id= ‘collab_message’ placeholder=’Proceed by sending a message.’></textarea> <input value=’".$useremail."’ name=’useremail’ id=’useremail’ style=’display:none;’> <input value=’".$postid."’ name=’postid’ id=’postid’ ..

Read more

I have a problem with an ajax. function sendData(){ if (navigator.onLine) { console.log(‘Verbunden mit send.php’); var timeID = localStorage.getItem("timeID"); var staffname = localStorage.getItem("staffname"); var komminame1 = localStorage.getItem("kommi"); var lsloginDrivetime = localStorage.getItem("loginDrivetime"); var lsloginDrivetimeLat = localStorage.getItem("loginKooLatDrive"); var lsloginDrivetimeLon = localStorage.getItem("loginKooLonDrive"); console.log(komminame1); $.ajax( { url: ‘_action/send.php’, type:’POST’, data:{ timeID: "" +timeID+ "", komminame: "" +komminame1+ "", staffname: ..

Read more

So I’m trying to enable google authentication with passport google oauth20. I have created a button that submits the form to the backend like this. <form className=”auth-form” action =”/api/v1.0/authentication/google” method=”get”> <button type=”submit” className=”btn btn-light” > <img width=”20px” style={{ marginBottom: “3px”, marginRight: “1em” }} alt=”Google sign-in” src=”https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/512px-Google_%22G%22_Logo.svg.png” /> Sign up with Google </button> </form> But this ..

Read more

With my limited Knowledge of ajax requests,I wrote this function which uses a get request to send friend requests when the add button is pressed,but when I run local host,the code seems not to be working and I can’t figure out why. Html template: {% extends "posts/base.html" %} {% load crispy_forms_tags %} <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> ..

Read more

I am trying to call the date picker from my ajax function but it is not working. Following is my ajax code $(document).ready(function(){ $(‘#calander-btn-toggle’).on(‘click’, function(){ _this = $(this).val() if (_this == “ON”) { $(this).val(“OFF”) $.ajax({ url: “/calendar”, type: “GET”, data: {status: _this}, dataType: ‘json’, success: function(data) { console.log(data); $(‘#pull_request_list’).css(“display”, “none”) $(‘#calendar_view’).html(data.html) $(‘#calendar_view’).css(“display”,”block”) } }); } ..

Read more