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.
379
questions
9
votes
4
answers
2k
views
Country Guessing Game
I'm learning React and I made this country guessing game. What improvements/suggestions do you have for it?
Preview it here
...
3
votes
0
answers
138
views
Ajax file uploader jQuery plugin
I tried to write my first jQuery plugin. It's a very simple AJAX file uploader.
HTML
...
0
votes
2
answers
162
views
jQuery + PHP Form Submit and Refresh
Code below successfully processes and submits data to database. Is there anything else that needs to be included / considered?
PHP (note-process.php):
...
4
votes
2
answers
5k
views
Update database, refresh the page to show changes, show a success message
Follow up question for:
Update database, reload page then show a success message
I have a table of articles, in each row is a button to activate / deactivate the ...
3
votes
1
answer
73
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. The first version fetched data from chat transcripts using PHP. The sub-domain I have registered for my webspace ...
2
votes
0
answers
2k
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 ...
1
vote
1
answer
41
views
Is there a more efficient way of using ajax to update search results?
I have a HTML form that allows users to filter their choices when browsing. There are multiple fields (radio button groups) that when the user clicks on them, the search results are updated ...
4
votes
2
answers
10k
views
Best way to structure PHP AJAX handlers? [closed]
I'm just getting started with AJAX and am unsure of the best way to structure a PHP AJAX handler. I created a PHP file, ajax_handler.php, and the way I have it ...
1
vote
0
answers
48
views
Display tags on the page coming from the server
There is a site with posts that have tags. The site has a search for these tags, that is, you enter words / letters separated by a space and tags are displayed for you by matches. These tags can be ...
0
votes
1
answer
84
views
Ajax to load data for company products without refreshing the page
I am using AJAX script to fetch data from a database. For example, it has
Motorola
Samsung
Apple
as company and I use AJAX to fetch models of it, so that when Apple is selected then it shows Apple ...
4
votes
2
answers
5k
views
Laravel 8 registration and login with user profiles
I am working on a Laravel application (Github repo) that requires user registration and login.
After registration, the users can change their registration details (except password, for which there is ...
0
votes
1
answer
59
views
AJAX script to load data for mobile phones from table
Am using AJAX script to have data fetched from database. For example has
Motorola
Samsung
Apple
as company and using AJAX to fetch models of it. Like when apple is selected then it shows apple ...
1
vote
1
answer
260
views
Chaining backend calls from VueJS method using Axios
This is the first ever bit of front-end code I have ever written, I have tried to adapt the existing call that is there to the backend using axios, so I check on of the response object value using the ...
3
votes
1
answer
474
views
SetTimeout to populate Javascript Object while a function looped AJAX requests to get data
I wrote some code that will get the name and data of a node or multiple of nodes and put them in an object (seriesData) so I can use said object for a chart (renderChart). I used setTimeout() so ...
1
vote
2
answers
4k
views
JS page loading without refresh
As an exercise, I found a basic way of updating pages without refreshing, partially mimicking the behaviour of SPAs and routing libraries such as React Router. I was not looking for something as ...
3
votes
2
answers
321
views
PHP blogging application with AJAX loading
I have been working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twitter Bootstrap 4.
The latest feature added is lazy loading of posts.
From the Static_model (...
1
vote
3
answers
442
views
Custom function for serialization of form inputs (and selects)
I didn't find an equivalent of .serialize() for vanilla javascript, so I rolled my own.
...
3
votes
0
answers
290
views
PayPal Checkout API with PHP - Sending and retrieving additional data safely
I am learning to use the new API version of Paypal, and I have some doubts.
Note: I've tried this on https://www.sandbox.paypal.com and it works,
I have not done the tests on Live.
onApprove:
I ...
5
votes
1
answer
88
views
Angular directive to fetch resources to fill a table
I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable.
My immediate problem was, I have a table and needed to fill in one of the columns with ...
2
votes
0
answers
93
views
Go REST API feedback [closed]
My intention is to create an API as generic and DRY as possible using Go. To achieve this, I have made some more or less common decisions:
To use AJAX call to avoid reloading page when updating the ...
3
votes
0
answers
258
views
Random Astronomy Photo: React app using NASA's Astronomy Pic of the Day API
Random Astronomy Photo
About the project
This is a React app that generates a random photo from NASA's Astronomy Picture of the Day (APOD) API along with some interesting facts about it. This is my ...
0
votes
1
answer
152
views
Upgrade security and code quality of a website contact form
I have a simple website contact form created back in 2017.
The form was developed using PHP, PHPMailer, jQuery, HTML and CSS.
I would like to make sure the code is up to modern standards and secure.
I ...
0
votes
2
answers
4k
views
CodeIgniter CRUD using AJAX
I am trying to use AJAX with CodeIgniter. I have some code, but I am not sure that the code is in proper way / officially correct according to the programming way. All I want is that if someone in the ...
4
votes
2
answers
3k
views
using PHP and JS to fetch data for an entry
I need to fetch some data from a mysql database. For that I created get_data.php on the server and a js function to retrieve that data on the client. Is this the proper way to do it? What would you ...
2
votes
2
answers
95
views
JS script fetching GitHub API for personal website
I've built a very simple personal website, everything is in a single file because it is very straightforward, but I think the JS script could be better structured. All it does is fetch some repos from ...
2
votes
2
answers
351
views
Continually refresh game data using AJAX
I've been working with JavaScript and AJAX a lot in the past, and now I'm moving towards the backend and working with databases more. I want to update my game data in as close to real-time as possible ...
3
votes
2
answers
86
views
Display of doctors by category, ajax
Apologies in advance for my english...
We have a list of categories and a list of doctors, you need to output as follows:
category1
item1
item2
item3
category2
item1
item2
item3
Here is what I ...
6
votes
1
answer
145
views
Refreshing / Cycling through a parsed RSS feed every 5 mins
I am working on a monitor signage display and have a "welcome to RSS" feed with just a title and description. I have code from feedEk that's been tweaked a bit to parse the feed and cycle it ...
1
vote
1
answer
698
views
Newsletter Subscription Functionality in Codeigniter 3
I am working on a online newspaper/blogging application with CodeIgniter 3.1.8 and Twig.
The application is meant to offer developers and designers the possibility to very easily turn their HTML ...
1
vote
1
answer
56
views
Posting data via fetch and handling network errors
I've built a login panel, which will submit an email and password via fetch/POST. And I wanted to know the best way to handle network status errors?
Reason being, as I want to inject error messages ...
6
votes
1
answer
2k
views
Backbone.js dynamic table
I have been trying to learn backbone.js and I thought the best way to learn it is by writing a dynamic table (i.e. add, edit and delete rows of data). I am very familiar with Node.js (back-end). Any ...
3
votes
1
answer
865
views
Make Pagination using Ajax with Jquery, PHP, History.pushState()
Finally after a few months of searching and learning AJAX with pagination PHP and History.pushState() I created AJAX PHP pagination.
Test page
1. Ajax(index.php)
...
3
votes
2
answers
314
views
A contact form with CodeIgniter and Twig
I am working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twig. I use the Twig template engine for the front-end views.
I have put together this simple contact form which ...
1
vote
2
answers
94
views
Click a link to delete targeted content using Ajax
I used a glyphicon as a link to delete a comment:
...
2
votes
0
answers
108
views
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, especially the SetTimeout sections.
which part of the code should ...
5
votes
1
answer
761
views
AJAX with Vanilla Node.js/JavaScript – POST JSON without a form
I am new to node.js, ajax, and asynchronous code. I’ve pieced together a working way to exchange json between browser and server and am wondering if someone with more experience considers the approach ...
1
vote
0
answers
96
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?
...
2
votes
1
answer
38
views
Is there a way to consolidate Ajax dropdowns that filters data from MYSQLi database
I recently started a project which has a database of rail cars for a train simulator. Im trying to set up a way to filter the data based upon 4 categories "Car Type", "Road Name", &...
1
vote
1
answer
4k
views
Rewriting this function to use `promises` instead of `async: false`
Using parse.com's javascript API, I would like to get a variable number or images from img tags on a page and save those images in the currently logged in user's ...
1
vote
2
answers
195
views
Displaying filtered user data using Ajax and PHP
I want to get my code cleaner and more efficient. This code gets variables form a PHP file and filters it to show the selected user name, all available usergroups on a list box and the groups he is ...
4
votes
2
answers
126
views
Filtering from a file to show information
I want to get my code cleanner and more efficient. This code gets variables form a PHP file and filters it to show the selected user name, all available usergroups on a list box and the groups he is ...
4
votes
1
answer
34
views
Simple marker rendering
I am trying to render in a leaflet map that should render a single marker. I am building the JavaScript as follows.
build the map
an even listener for when the user opens the page where the map is ...
3
votes
2
answers
603
views
Getting data from database through Ajax post request
Is the method used below to get data from a database efficient and optimal? The data is in a MySQL database, and in my server I have a PHP file with the following code to return some information:
<...
0
votes
2
answers
3k
views
Handling keyup events with throttle or debounce in Javascript/jQuery
In my web application, there is a search input field, and when the user empties all of the text inside the input field, there is an API call made for a default-list of results, which are displayed in ...
1
vote
2
answers
177
views
Is this code written safe from attacks?
I have small question. I don't know much about JavaScript (jQuery) or AJAX and I don't know whether I'm doing it safe from XSS Attacks, SQL injection and that stuff. I think the PHP with MySQL would ...
3
votes
0
answers
433
views
Dynamic dependent dropdown in jquery
I'm trying to create a dependent dynamic dropdown in jQuery, in which the number of dropdowns is not fixed. Let's say we've four provinces, each has cities, and each city has sections. Each section ...
1
vote
1
answer
2k
views
My method of php ajax product filter with pagination
After a few weeks of searching and learning ajax, pagination php, product filter, I created ajax php product filter with pagination.
1. index.php
...
6
votes
2
answers
186
views
Quickly throwing together a text-and-button-based client-server web game
With much of the world in lockdown at the moment, my friends and I wanted a way to play our favourite game, Celebrity, over video chat.
This seemed like a fun coding project, so I put together a ...
1
vote
1
answer
2k
views
The most minimal way to retrieve live data using setInterval
I am writing a script that is supposed to retrieve some data from a MYSQL database but I need to make it happen live and after lots of research I learned that this thing can be done using something ...
2
votes
1
answer
64
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 ...