Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.1 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
        <title>Import Product</title>
        <script src="js/jquery-1.4.2.js"></script>
        <script type="text/javascript">
      $(function(){
        $("#submit").live('click', function() {
                        var entityId=$('#entityId').val();
                        jQuery.ajax({
            type : "GET",
            url : "/hotspot/products!fetchEntityDetails?entityId="+entityId,
            success : function(response) {
                        if (response===""){
                                alert("Error : Not valid entity");
                                return;
                        }
                        
                $("#details").css("display", "");
                $('.productName').text("Product Title : "+response);
            },
                        error : function() {
                                alert("Unable to fetch details");
                        }
        });  
        });     
        });
        </script>
        <script type="text/javascript">
      $(function(){
        $("#addProduct").live('click', function() {
                        var entityId=$('#entityId').val();
                        jQuery.ajax({
            type : "GET",
            url : "/hotspot/products!addEntity?entityId="+entityId,
            success : function(response) {
                                alert(response);
                                location.reload();
            },
                        error : function() {
                                alert("Unable to add details");
                        }
        });  
        });     
        });
        </script>

</head>
<body>
        <h2>Import Product</h2>
        <div>
                <lablel>Entity Id:</label>
                <input name="entityId" id="entityId"></input>
                <input type="button" id="submit" name="submit" value="Fetch Details"/>
        </div>
        <div id="details" style="display:none;">
                <p class="productName"></p>
                <input type="button" id="addProduct" value="Add Entity"/>
        </div>
        
</body>
</html>