I’m trying to make a simple API with PHP and a way to retrieve data from it in JavaScript but I keep getting the following error: SyntaxError: Unexpected token < in JSON at position 0. The JSON is valid and I’m not sure what is causing the error… I’ve tried setting headers and the d…
Tag: javascript
How can I call a Javascript variable on PHP(HTML)
So what I’m trying to do is something like this: I want to name the new dynamic textbox. So I could call it later on another PHP page. Answer You have to send the javascript value through ajax POST to the server and read the post via php. Not so sure what your aim is but let me know if
how to include javascript inside html
Sorry for asking this silly question. I got stuck to include a javascript file in my html page in a php project. when I try this it works fine- <script type=”text/javascript” src=”script.js”></script> But when I want to load the script.js file from my js directory it does n…
Laravel Echo Listener not working on frontend
I have created an event: Here is the bootstrap.js: and the route: laravel-echo-server.json : ENV file: When I set the broadcast driver to log: When I set the broadcast driver to redis & monitor redis via CLI: It looks like everything works fine, but the browser console in frontend doesn’t show any l…
Problem: The current div disappears when the task inside it is done
here is my HTML: Here is my php: here is my Javascript: What i want is to click on the tasks-button and display the respective template. The problem is when I update/add/delete some data from my Database it refresh the page so it will display just the three button and not the content of the div you were on. I…
How to handle error from controller using PJAX in YII2?
I am using Yii2 Pjax widget which is unable to throw error from controller due to which I am unable to log error for users when there is any error coming from the controller. PJAX code CONTROLLER code: I have tried below clientOptions but not working Also used javascript but no help :- Is there any way from w…
HTML Log System with javascript or maybe php
Hi I tried to make a log system panel to my website. The code is works fine because if you write the text into the input field it will show up. But if you reload the page it will disappear. So my problem is the disappearing text. I want to do this when I type the text so it doesn’t
Hide element when another element is present on the page
I want to hide an element if one element is already present on the page. If element with the id: is present on the page, then hide following element: I want to achieve is either through a function or .css, it doesn’t matter. Answer Just do it with JavaScript.
jQuery change other value if main input form is (on.change)
I am using Laravel and javascript + jQuery then, what I need is if I click the select option value, it will change the other form input based on (count value). Here is my preview image : nah if i click the value of select option in “Tipe Biaya” column, it will count jumlah column*biaya operational…
Laravel: Delete data with wrong ID
I use the Delete button to delete data, but when deleting data, the deleted data does not match the rows I mean, but the data that is deleted is the data that is at the top of the table when I use …