I am new to Node.JS and writing a program on expressjs. I have an app.js node program with following route
app.get('/registration2',function(req,res) {
console.log("app.js");
res.render('registration2');
});
This works fine when I use it from menu using
<li><a href="/registration2">Become Member</a></li>
but when I call similar using jqury it doesnt render page registration.
app.get('/pr1/:price?',function(req,res) {
var price = req.params.price;
console.log(price);
res.render('registration2');
});
I used console.log(price) just to check whether it is capturing varible price correctly and i found that console.log does show correct result my jquery is as follow
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$.get("/pr1/499");
alert("OK");
});
});
</script>
Aucun commentaire:
Enregistrer un commentaire