Home / CSE MCQs / ExpressJS :: Discussion

Discussion :: ExpressJS

  1. Imagine that you sent following ajax request:
    $.post("/process", {name:'john'}, function(data){
        // Do some stuff
    });
     
    What will be the answer from the server?
    Tip: On server side, we have the code which is given below
     
    Code:
    app.post('/process', function(req, res){
        var data = '';
     
        if(req.xhr){
            data += 'One';
        }
     
        if(req.body.name){
            data += 'Two';
        }
     
        res.send(data);
    });
  2. A.
    OneTwo'
    B.
    'One'
    C.
    'Two'
    D.
    All of these

    View Answer

    Workspace

    Answer : Option A

    Explanation :



Be The First To Comment