I am working on a course project in which I am required to use php to make api calls. The Ajax call looks like this: The php api call looks like this: This works perfectly. I have used the same routine to make similar calls go the geonames API and had no issues doing so as they provide the name
Tag: jquery
On element click get text of a child element and pass it in an input field using jquery or plain javascript
As per title in my code below I have 4 divs that contains 4 different numbers. What i want is when i click on each div the amount of the clicked div to be inserted at the input field. My problem is that when i click any of the divs it pass all the amounts in the input field. Here
How to change the value of a global variable when a user select an option
i have the html below where i let the user choose between two options After that i initialize a global variable that gets the “gr” value. I want to change the global value based on what the user chooses from the drop down menu (gr or en). On change selection event, i tried the code below but the variable Language
How to hide div that has a table inside if the table’s is empty when filtering using search?
I’m trying to hide the whole div(where there’s a table inside) when the result from filtering/searching thru the table is empty. So far, I have this: As you can see, although the table is properly searched, the div and the table that has no value in its <td> is still showing. How can I hide the whole div if the
Looping through selectpicker options
I am working with a selectpicker that contains optgroup and option elements. I would like to loop through the options and “select” all options that have a value starting with a certain string. For example, if I have the following: and some buttons “Vegetable” and “Fruit”, I would like all of the options that have values starting with “V.” to
Sync two scrolls with different sizes
I have been trying to sync two different divs with different sizes. As you can see in this jsfiddle I’m almost there. But while move the bigger horizontal scroll the inner one doesn’t finish at its final scroll end. I want both to be synchronized, start and finish in their own sizes. I have tried to play with their width
Convert PHP array from AJAX response to Javascript Object
I’m trying to create a JavaScript object based on a template I received as a test. I use Ajax to get the data from my database but i cant seem to create the object. I’m trying to create something like this object below This is the how i fetch the data from my database Answer Your lines with products[x] overwrite
intersection observer works only for the first video
I need to pause a video if it is not in view the below code works only for the first video in list how to make it working for all .bvideo ? Answer Use querySelectorAll() method.
How to call variabled ajax
I put the ajax call in a variable, how can I call it again and pass some parameters to the data attribute of the ajax?. now I have a date range picker, If i click apply button i just want to call the request variable to be able to trigger the ajax call again and pass some parameters. TIA Answer
How to change a event listener from hover to click depending on device width on javascript
i am facing issue on jquery while using hover listener event, the code is just working on desktop while on mobile i can’t get it to work with the hover listener.So i just wanna implement click function instead of hover when the site is being displayed on mobile and hover on pc/laptop.I am sharing my code below. Also i am