0

REQUEST URL http://localhost:9090/rest-api/fetchDetailedProductInfo?prodId=1&tempId=123

fetchDetailedProductInfo: function (prodId) {                                      
    var self = this;
    var URL = 'http://localhost:9090/rest-api/fetchDetailedProductInfo'
    $.ajax({                                               
        url: URL,
        dataType: 'json',
        contentType:'json',
        type:'GET',
        data: {
            'prodId':prodId,
            'tempId':123
        },                       
        success:function(responce) {
            self.renderUI(responce.json);
        },
        error: function (err) {
            console.log('ERROR',err)
        }
    });                    
},

@ SERVER SIDE

router.get('/rest-api/fetchDetailedProductInfo', function (req, res) {  
    var prodId = req.param('prodId');
    var tempId = req.param('tempId');
    res.send(prodId + '----' + tempId);
}

1 Answer 1

1

I think you confused with req.params and req.query. Here is link to another question

Use req.query

 var prodId = req.query.prodId;
 var tempId = req.query.tempId;

Please see this

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.