« first day (1768 days earlier)      last day (2349 days later) » 

 
2 hours later…
 
5 hours later…
 
3 hours later…
15:49
Hi folks.
I have an express/nodejs app.
There is some variable/file scope issue. The guy in the tutorial vid does not have it, so I think things have changed in express.js.
I have the app.js file where i do this:
var movies = [
{
title: "The usual suspects",
stars: "IMDB rating",
score: 8.4
}].
Then I have the index.ejs file, there:
<% movies.forEach(function(movie){ %>
<p> <%= movie.title %>xxxx </p>
<% }); %>
And then I get this error:
movies is not defined/ref error
1 message moved from JavaScript
 
3 hours later…
 
1 hour later…
20:34
```let topPlusButton = document.querySelector('.percentage-div .add')
let topMinusButton = document.querySelector('.percentage-div .minus')

topPlusButton.addEventListener('click', (e) => {
e.preventDefault()
let topPercentInput = document.querySelector('.enter-account-percentage').value || 0
console.log("input value: ", topPercentInput)
incrementedValue = parseInt(topPercentInput) + 1
console.log("new value: ", incrementedValue)
topPercentInput.innerHTML = incrementedValue
})
topMinusButton.addEventListener('click', (e) => {
1 message moved from JavaScript
$("#category").change(function() {
var form = $("#subcategory");
var price = $('#price');
var category = document.getElementById("category").value;
if(category) {
$.ajax({
url: '/advertise/public/subcategories/' + category,
type: "GET",
dataType: "json",
success:function(data) {

for (var i = 0; i< Object.keys(data).length; i++) {

if (parseInt(data[i].category_id) == 1) {
console.log(data[i].name);
form.empty();
$('<div class="form-group">'
+ '<label>السعر</label>'
+ '<input type="number" class="form-control" name="price" placeholder="السعر" value="">'
1 message moved from JavaScript
@Natty tp
and vote to delete ^
this one as well delete stackoverflow.com/a/39673143/680068
 
2 hours later…

« first day (1768 days earlier)      last day (2349 days later) »