Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
How can i get different data?

JavaScript code:

$(function() {
        timer = setInterval( function () {
            $.ajax({
                url: "ip/img",
                type: "get",
                context : this,
                cache : false,
                error : function(request,status,error){
                    alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
                },
                success:function(obj){
                    $("#imguri").html('<img src="'+obj.data+'">');
                    //$("#imguri").attr("src", obj.data);
                    console.log(obj.data);
                }
            });
            }, 3000);
        });

Print same data enter image description here:

My server code:

client.on("message", async(topic, message)=>{ // {"LED" : "ON"} or {"MOTER" : "ON"}
    if(topic == "JPG")
    {
        var obj = message.toString();
        app.get("/img", function(req,res,next){
            res.set("content-Type", "text/json");
            res.send(JSON.stringify({data : obj}));
        });
        console.log(obj);
    }
}

Print different data:

How can I get a different value each time from http?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!