I’ve a php page which returns a full-fledge js snippet when we query that page. Let say that page is get_js.php and looks something like this: The ask here is that the value returned by that get_js.php should be executed on client side when we do an ajax call. The echo string above is just an example and can be
Tag: javascript
Sending a JSON string to HTML that is too large
I’m using Codeigniter4, and I generate a rather long JSON so that I can make map points with it. However, when I pass along the string with And attempted to unpack the string on the html side with I get a syntax error because the entire json string was not sent. I have tested my setup with a smaller amount
Prevent XSS attacks when echoing HTML using PHP
I have a simple bimple function which echoes this: This just works fine, but If a user edits the HTML using a Chrome or Firefox, he can modify the code to output something like: I have set the only http on the php ini relating the cookies, but is there any way to prevent the user from modifying and successfully
After the condition of a select is met, show or hide further selects
I have the following question because I haven’t found anything on the internet. I have created several selects with HTML. The select has the optiions yes / no. The first select checks whether the topic is relevant, if it is not relevant, then the remaining selects for the topic should disappear. I then send the evaluation of the selects with
The cookie is not created js
I’m planning a registration system. Right now I’m trying to send a randomly generated session string to the mysql db; besides sending it on db I want to create a cookie with the js that contains the session string. I tried with the following code but I don’t know why the cookie is not generated. Would anyone know how to
How to save canvas image to server with JavaScript and PHP?
I’m struggling with saving my canvas image to server using JavaScript and PHP. I’ve tried multiple examples for both JS and PHP and it always fails. There’s conflicting advice on how to send image …
ERROR: POST http://localhost:8765/users/delete/delete8 403 (Forbidden)
I’m using cakephp4. trying to add some sweetalert. Sweetalert is popping up when the delete button is clicked but when I click confirm for delete it’s not deleting the data. template/layout/Users/index.php template/layout/Users/index.php delete method is as follows in my UsersController.php UsersController.php Route File is here config/route.php }); Answer I am sure it’s the CSRF token. Try to replace with Also
How to cast string boolean from MySQL to real boolean in Javascript?
I built a php backend for my ReactJS frontend. My mysql users table has a checkedIn column that is stored as tinyint. I am fetching it like: And in my frontend: My log gives me: How can I modify my backend or my frontend, to have a real boolean value for checkedIn in the frontend? I expect: As a side
How to change the me when receiving email on contact us
I’ve created an contact us form using PHP Mailer, however the problem is when I received the email the name before you open it is me and I can’t figured out how to fix it. Also I appreciate it if someone explain to me what is the different between Username and the add Address. Thank you in advance. Here is
HTML Calendar and JS problems
I would like to make a Javascript-based calendar for managing holidays. My problem is, I am using a SQL database to store the holidays, which I am accessing with PHP. How can I use the results of the PHP query in a JS Script ? For example, to add holidays for an employee i have to do that : When