phantomon icon

xD

phantomon | PRO | 03/13/12 06:06:49 AM UTC | 0 ⭐ | 214 👁️ | Never ⏰ | []
JavaScript |

640 B

|

None

|

0 👍

/

0 👎

// JavaScript Document
 
var _clickedIdea;
 
$.post("rest.php",{instruction:"getLastIdeas"},function(data){
    
        var ideas = $.parseJSON(data);
        
        for(var i = 0; i < Math.min(6,ideas.length); i++){
        
            $("body").append("<div class=\"modal\" title=\""+ideas[i].id+"\"></div>")
            
        }
        
        $(".idea").click(getIdea);
    
});
 
function getIdea(evt){
    _clickedIdea = $(this);
    var idea_id = _clickedIdea.parent().attr("id");
            
    var _id = idea_id.split("_");
        
    $.post("rest.php", {instruction:"getIdea", id: _id[1]}, showPopUp);
}
 
function showPopUp(data){
            
    var idea = $.parseJSON(data);
                
    $("div.modal").attr("title", _id[1]).append(idea.id);
}

Comments