Category : updates

How to change my code, when I push the button again the information is adding to previous, I need that when I push the button the information updates. document.querySelector(".city-select").onchange = () => { let strUser = document.querySelector(".city-select").value; updateInfo(strUser); //getWeather()// при селекті } function updateInfo(strUser) { fetch(`http://api.openweathermap.org/data/2.5/weather?q=${strUser}&appid=f3ab273b1163fcf008d6d3ce02f9e86e`) .then(function (resp) { return resp.json() }) .then(function (data) { ..

Read more

Trying to modify object value in array on condition on some arrays the override does not work, here is my snippet const removeAction = (target, array, name) => { let mutation = JSON.parse(JSON.stringify(array)); mutation.map( obj => { if(obj.value === target.value) { console.log(obj) obj.checked = false } return obj }) console.log(mutation) removeCallback(mutation, name) } and I ..

Read more

I develop a shopping website and i got stuck , I unable to function the buttons that increse the quantity of the items and update the localstorage,"Uncaught TypeError: Cannot read property ‘place’ of undefined " here’s the js code. thx for your help! let products_1 = [ { name: ‘new’, tag: ‘Birthday_cake’, type: ‘Birthday_cakes’, price: ..

Read more

I created an object store with autoIncrement: db.createObjectStore("items", {autoIncrement:true}); Now I want to be able to update an item given its key and a new value, so I wrote this function: let updateItem = (key, newData) => { let objectStore = db.transaction(["items"], "readwrite").objectStore("items"); let request = objectStore.get(key); request.onsuccess = (e) => { let data = ..

Read more

$(document).on(‘click’, ‘.update’, function() { var user_id = $(this).attr("id"); $.ajax({ url: "fetch_single.php", method: "POST", data: { user_id: user_id }, dataType: "json", success: function(data) { $(‘#userModal’).modal(‘show’); $(‘#name’).val(data.name); $(‘#status_id’).val(data.status_id); $(‘#note’).val(data.note); $(‘#note_tow’).val(data.note_tow); $(‘#note2’).val(data.note2); $(‘#note3’).val(data.note3); $(‘#payment’).val(data.payment); $(‘#ntg_no’).val(data.ntg_no); $(‘.modal-title’).text("تعديل الحالة"); $(‘#user_id’).val(user_id); $(‘#action’).val("Edit"); $(‘#operation’).val("Edit"); if ($("#note").val() !== ”) { $("#note").prop("disabled", true); } else { $("#note").prop("disabled", false); } } }); }); I am ..

Read more

I was studying this part of React documentation: https://reactjs.org/docs/lifting-state-up.html. I have a similar problem in a project of mine, but with a slight difference. We can use the same example as the documentation, with a little alteration to suit my problem: let’s suppose that instead of <TemperatureInput /> I have <Sensor /> components. This sensor ..

Read more