-1

So I'm polling my server for information. Below is what I get back through firebug, but I'm only wanting the new notifications to post into their div if the response.notification_status value of 1 is met. Because as soon as it polls it again that very notification is set to the value of 2.

 {"num":1,"notification_id":"783","notification_content":
    "Lucy  Botham posted a status on your wall","notification_throughurl"
        :"singlepoststreamitem.php?streamitem_id=663","notification_triggeredby":"85",
    "notification_status":"1"
        ,"notification_time":"2015-11-08 01:58:22"}

And my actual success and what I've tried.

success: function(response){
if(response.notification_status = 1){
//PREPEND NOTIFICATION
}

1 Answers1

2

The problem right now is that the operator =, that you are using in your if statement is the assignment operator, and cannot be used to compare values. What you need is the == operator. So you would need to do something like this:

success: function(response){
if(response.notification_status == 1){
//PREPEND NOTIFICATION
}
Tonlage
  • 51
  • 4