-1

I am having server file i.e.node_app.js , client files login.php,group.php and display_group_details.php.

After login using Jade (view template engine) login page redirected to group.php, here on group page, I have table with group list having columns id,group_name,description,capacity and last column with 'show detail' button.

When I click on 'show detail' button I want to open popup with details of selected group. As per my code popup get opened, URL is showing in address bar but no page content displayed initially, it displayed when I refresh the page.

It must open popup with page content not after refresh.

Here is my code:

app.get('/joined_group', function (req, res) {
selected_group_id = req.query.grpid;

var qry= "SELECT * FROM `groups`  where `group_id` = "+selected_group_id;
    con.query(qry, function(err, result, fields)
    {
            res.render('group_details');//name of jade file
    });
});

In Jade file named group_details i have code like :

include details.php

What I am doing wrong or what things are missing?

NOTE: Previously when I am not using xampp to run this application code was for button click like :

<button class="btn btn-primary"  onclick="window.open('/joined_group?grpid=1','name','width=1200,height=600','_blank')">
                                        Join</button>

Now I am using xampp so as ports are different for Xampp (Apache) and Node http server, code is like

<button class="btn btn-primary"  onclick="window.open('localhost:8087/joined_group?grpid=<?php echo $group['group_id'];?>','name','width=1200,height=600','_blank')">
                                        Join</button>

Using this popup get opened but blank, it displays content after refresh, but it should not be like that.

NOTE: please have a look on code I have edited, node_app.js after button click (as shown earlier above but with some changes , send parameters along with file as )

  res.render('group_details',{grp_id:selected_group_id,grp_name:result[0].grp_name,loggeduser:'test'});

and group_details.jade :

   script(type='text/javascript')
  | var grpid="#{grpid}"
  | var grp_name="#{grp_name}"
  | var loggeduser="#{loggeduser}"
  include details.php

am I doing something wrong or missing some in jade file or node node_app.js file while loading page after button click?

Nil
  • 5
  • 6
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Oct 09 '17 at 10:58
  • @ halfer , from onwards I won't use such words .I tried many ways for my issue but no output so put 'urgent' word expecting quick solution. :-( – Nil Oct 09 '17 at 11:17

1 Answers1

0

Hi Finally i got what to be done if using xampp as well as node.js server.

I have followed answer of "T.Todua" of post : How to install nodejs on Xampp localhost

its working now. Thanks!

Nil
  • 5
  • 6