0

When ajax compass with the value new prices you can see it it the succes function.

But if you want to see the value under the ajax function new_prices is undefined ??

How is this possible?

var new_prices;

         $.ajax({
            type: "POST",
            url: "/spares/admin/getKoersBetweenDate/",
            dataType: "json",
            data: "valutaId=" + valutaId + "&datum=" + date_added,
            success: function(response){
                  var new_price = price_ps / response.valuta[0].koers;
                   var total = new_price;
                   new_prices = total;

            }
        });
         console.log(new_prices);
cнŝdk
  • 31,391
  • 7
  • 56
  • 78
da1lbi3
  • 4,369
  • 6
  • 31
  • 65

0 Answers0