Questions tagged [ajax]

AJAX (Asynchronous Javascript And XML) is a popular technique for creating interactive websites, allowing web content to be updated asynchronously by exchanging small amounts of data with the server behind the scenes.

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

Loading KML files into leaflet Javascript map

This is working code for input KML files into leaflet map ...
4
votes
2answers
97 views

AJAX communication with pure JS and PHP

I'm looking for a good approach to AJAX communication using only pure JS and PHP. I would like it to be as safe as possible and compatible with most modern browsers and IE 10+. I did some research and ...
2
votes
0answers
74 views

Contact form with AJAX call and secured PHP with Google reCAPTCHA v3

here is a code of a simple contact form that I have created, I believe that the form is server-side protected against empty fields, header injections, CSRF, XSS, bots using 'Google reCAPTCHA v3' and ...
7
votes
2answers
59 views

Vanilla Javascript: Chained AJAX request

I'd be grateful for a review of my AJAX request. If I have taken the correct approach here and especially any security concerns! I am creating a Purchase Order system for my manager (as part of an ...
3
votes
1answer
60 views

Ajax function with a callback

I have Ajax function with a callback which fetches all the Patient data however I have some perfomance issues and trying to figure out what it might be, does anyone have idea? That's my Code ...
1
vote
1answer
45 views

Dynamically inserting html from external file and updating the database

I need some suggestions on how to approach this. I want to allow users to create sections of website. The code so far is working but since I am new to back-end I feel like there is better, more ...
4
votes
1answer
104 views

Pulling data from the GitHub API for user repositories

I'm looking for specific feedback on a major design change that I plan on making to my personal website (https://aleksandrhovhannisyan.github.io/). Currently, the Projects section contains hardcoded ...
3
votes
2answers
67 views

Shopping cart with Ajax

I build a cart for an ecommerce website, and I want to know if I did well. I want to record the changes in the DB and display the information from the DB to the customer. To be sure that what he sees ...
1
vote
1answer
32 views

Thoughts on using curly-brackets-less while loop with a try/catch? [closed]

I need to fetch data from an server that isn't always reliable and unfortunately fixing that is out of my hands. My team determined we would attempt the request up to 3 times. So I thought of using a ...
2
votes
0answers
54 views

Make Pagination using Ajax with Jquery, PHP [closed]

This is the first time that I have add (I mean, I try) Ajax with Jquery to PHP and Mysql (pagination). This is a link to the test page: testpage1 I think everything works, but is it done correctly? ...
0
votes
2answers
65 views

Asynchronous query to load products from laravel controller

The following code works fine. When a user clicks on an element, an AJAX request is made, which will return the query result. The results are being displayed in a view. I read many articles where ...
2
votes
1answer
71 views

Passing data to HTML template

How can I pass data from database to my HTML template without putting PHP code in my HTML file. Thanks. This is my controller ...
1
vote
0answers
40 views

multiple AJAX requests and multiple SetTimeout animations

multiple AJAX requests and multiple SetTimeout animations I wrote a piece of code that included multiple AJAX requests and multiple SetTimeout animations. I want the code to perform better, ...
0
votes
1answer
69 views

Hotel Booking functionality - handling UTC dates & timezones

People here often ask to share as much code as possible. My app is just a sandbox, a typical freshly created AspNetCore + Angular template without much code. So please don't blame me - I provide ALL ...
0
votes
0answers
21 views

Asking data to a Servlet from jsp and send them back to the jsp

Image that a user have to book a private lesson by compiling this form. Using MVC pattern I'm building a WebApplication to achieve this goal; I have a jsp wich contains the form and by using Ajax I ...
3
votes
1answer
55 views

Edit button toggles modal and load data from PHP using AJAX and JQUERY

I've been working on an edit/update button that will toggle a modal that looks like this: Is there a better code for this JavaScript code that I made? ...
9
votes
2answers
88 views

Fetching movie data using jQuery

Requirements Display movie datas inside all tags that have the class movie_list Make an ajax call for fetching movie datas Fill loading text before fetch data If any error occurs during loading, the ...
0
votes
1answer
83 views

Updating values in a database

I'm using standard jQuery Ajax to update values in the database and reflect the result in an output. This repetition seems like bad practice and I don't know enough about jQuery to consolidate this ...
3
votes
1answer
69 views

PHP AJAX handler to fill an HTML table

I would like to know if this code follows recommended practices and standards for AJAX/PHP calls. Can this AJAX + PHP code be improved in terms of security, performance, etc.? ajax.js: ...
1
vote
0answers
58 views

Load more and filtering - WordPress AJAX

In my WordPress theme I have built a function that uses Isotope Layout by Metafizzy to accomplish filtering and sorting. I have used a mix of AJAX and JQuery to accomplish this, however I feel the ...
0
votes
1answer
40 views

Displaying multiple objects on map and calculating distances using google api

I am quite new to Javascript. For a school project we wrote a website that displays the user's location on a google map alongside with some objects such as vehicles or passengers. I rewrote my code ...
3
votes
0answers
95 views

AJAX shopping cart with quantity +/- buttons

I'm a junior developer (couple years into it) and very new to AJAX. I'm writing an internal inventory application built on MVC and right now I'm dealing with adding and removing items to/from a cart. ...
3
votes
2answers
97 views

Use weather API to get information in JavaScript + jQuery

Please can any code experts review and improve my code? HTML ...
2
votes
1answer
240 views

Symfony AJAX comment system with votes

How can I improve this code ? It was quite hard to implement AJAX comment system in Symfony 3, and result is a bit of mess: Controller: ...
3
votes
1answer
359 views

Upload a user's avatar

Could you guys tell me if my code is safe? And i want to know how to improve it. You will see a detailed explanation about the code on the comment blocks inside the code. profileIMGform.php <...
1
vote
4answers
73 views

Replacement function for jQuery .post

Today I just completed a personal POST function that emulates jQuery's using $.ajax, but also implementing a possible redirect. I just finished up and it looks like it is functional, but since this is ...
2
votes
1answer
43 views

Chart of answered CR posts percentages over time - Part 2

I created a graph to show the change in the percentage of questions answered over time and the first version fetched data from chat transcripts using PHP. The sub-domain I have registered for my ...
2
votes
1answer
504 views

Notification system using PHP+jQuery+Ajax

I have this code to display a counter on the side of <i class="fas fa-bell mr-3"></i>. I want to know if this code is good on security and perfomance. ...
0
votes
1answer
439 views

Preparing form data for a POST request with fetch

Acquiring a form’s data for asynchronous POST requests has been a long-standing problem. There is the FormData API, but there are still some obstacles when the form’s data is encoded as ...
1
vote
1answer
66 views

Back end validation as front end validation

I am trying to use the back end validation for front end validation and this is what I got. Maybe there is a better way to do this? If someone knows please share the knowledge. HTML: ...
0
votes
0answers
38 views

License Manager PHP Class

I'm workin on this code that will be a licensing class integrated with an electron app. For now it's a simple object who will generate and check for a licence stored inside the electron app folder. I ...
3
votes
1answer
52 views

Ajax table action and process

I'm trying to learn Ajax better, and I'm developing an application in CodeIgniter. The following code is working, there are no errors. But for every function and call I think I'm repeating callbacks ...
1
vote
0answers
20 views

Deletion button on a website that enforces database integrity

I am designing a website on which users can configure (CRUD) various objects which are mutually dependent upon other types. I am preventing a cascade delete, so let's say a ...
4
votes
1answer
123 views

Effective to-do list in PHP and jQuery AJAX

I made this to-do list since I never seriously used jQuery (in particular way AJAX) and I need this kind of script for a project that I'm working on. Principal features: Use of a database to manage ...
1
vote
1answer
135 views

WeatherApp, working with APIs

I'm making a WeatherApp. It uses the browser's location to get the GPS coordinates, then sends those to an API to get details about the location (e.g. city, country, etc.). The city is then sent to a ...
0
votes
1answer
82 views

jQuery AJAX submit form

This jQuery code submits a form using AJAX. The server response should return JSON. ...
0
votes
1answer
83 views

pass argument to jQuery .on() event handler callback [closed]

In my web application, a user will click a button which will call a function that triggers an AJAX call. That function accepts a single argument. I would like to be able to put that function in ...
4
votes
1answer
7k views

Send blob image using Ajax/PHP

I have an image cropper that crops the uploaded image, Before sending it to the server using PHP and AJAX. Here is a live fiddle to preview a working cropping example. Here is the code: ...
2
votes
1answer
199 views

Paginated AngularJS posts application

I have made a small application that displays a posts JSON in the form of cards, with the help of AngularJS and Twitter Bootstrap 4. The application has an interface for pagination and there are ...
5
votes
2answers
120 views

Upvote/counter in Javascript

Looking to improve building UI in pure ES6. This is the pattern I have adopted and has worked fairly well. This code increments the count, sets a data attribute to toggle the button, and issues a ...
3
votes
2answers
53 views

jQuery handler to update map UI based on AJAX response

I am working on a university project that consists of creating a map application with openlayers as well as the necessary User-Interface. I am using jQuery, native JavaScript, PHP and of course HTML/...
3
votes
2answers
64 views

Update game content via AJAX

On my application, I have a JavaScript cycle that updates tag contents on my page regularly: ...
0
votes
1answer
22 views

Click a link to delete targeted content using Ajax

I wrote a glypicon as a link to delete a comment: ...
1
vote
0answers
17 views

JSON API Scraper v2: Limited concurrency AJAX from a shared queue (ES2017)

Essentially the AJAX component of this question, reimplemented in ES2017 style async/await. The code connects to a remote JSON API and scrapes it using a limited number of streams to avoid triggering ...
2
votes
2answers
103 views

Basic PHP template loader

For a project, I need to write a basic template manager who will be responsible to load the requested HTML or PHP template when the user clicks on a menù link. It's like a page loader since that all ...
0
votes
1answer
109 views

Writing cleaner PHP code to add additional options

I have a contact form that will perform validation on the server. Right now the form checks if the fields are empty or not. My goal is to expand it following: Check the fields for particular format, ...
0
votes
1answer
33 views

Simple AJAX view loading approach

I'm writing my own MVC framework for learning purposes. Usually in my projects I like to use AJAX to send requests and retrive data. Now my doubt is if this can be ...
1
vote
1answer
75 views

Live search project

I have a live search project and I don't know if it's secure enough or not. I don't access it directly, but I get data by JSON so I shouldn't worry about slashes or quotes, right? The PHP code: <...
4
votes
1answer
152 views

Upload and database insert php function

I love to post here on codereview my code to have a feedback from developers that have more experience than me, to improve my coding skills. During these days I'm working on a webapp for a small ...
1
vote
1answer
56 views

store and warehouse management class

I've already posted this PHP class few days ago when I started writing it. Now that all the methods and all the controller logics are ready, I will be ask here for some suggestions about how to ...