Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Further go to another URL

Dear,
It would further go to another URL previously, when I click record below
User generated imageto this URL.
http://my-friend.co/HouseList4/Default.aspx?userid=mc23

But now it does not, and why?
Avatar of HainKurt
HainKurt
Flag of Canada image

when I click it goes to this address

                if (window.opener != null) {
                    //opened via window.open
                    url = "http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=y";
                    window.location.href = url;
                    var myWindow = window.open(url, "myWindow", "width=800, height=900");
                }

Open in new window


http://my-friend.co/HouseList4/JavaScript1.js, Line 195

when we click, you are changing the current page url + open a new window...

url change
http://my-friend.co/RegRec2/?id=18&user_abbr=mc2&readonly=y

new window
http://my-friend.co/RegRec2/?id=18&user_abbr=mc2&readonly=y
Avatar of Peter Chan

ASKER

Sorry to that, it now does not go to the expected URL. What is wrong to the following URL?
http://my-friend.co/HouseList4/Default.aspx?userid=mc23
I dont get what you are asking...

you are showing an image and say, when you click it should go to

http://my-friend.co/HouseList4/Default.aspx?userid=mc23

so, where is that image?

is this the page that yopu click: http://my-friend.co/HouseList4/Default.aspx?userid=mc23

where should it go when you click images on this page?

I showed you what is happening when you click, you have the js code that shows where to go...

I dont get what the issue here...
No, when I click the record (as shown in the screenshot above), I expect it would further go to another URL. But now it does not.
check my first post again...

it is doing what your code says to do so...
when I click it goes to this address

                if (window.opener != null) {
                    //opened via window.open
                    url = "http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=y";
                    window.location.href = url;
                    var myWindow = window.open(url, "myWindow", "width=800, height=900");
                }

Select all
 
Open in new window

http://my-friend.co/HouseList4/JavaScript1.js, Line 195
Why doesn't it go to that URL, when I now click record, within this?

http://my-friend.co/HouseList4/Default.aspx?userid=mc23
still I dont get it...

it is going to this page

http://my-friend.co/RegRec2/?id=18&user_abbr=mc2&readonly=y

+ opens a new window which goes to same url

http://my-friend.co/RegRec2/?id=18&user_abbr=mc2&readonly=y

this is what your js says... and it is working as expected...
Sorry, now really nothing happens, when I click record within this URL

http://my-friend.co/HouseList4/Default.aspx?userid=mc23
$("#houses .houserow").on("click", function () {
                //alert($(this).find("td :nth-child(2)").html());
                id = $(this).data("id"); //alert(id);
                if (window.opener != null) {
                    //opened via window.open
                    url = "http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=y";
                    window.location.href = url;
                    var myWindow = window.open(url, "myWindow", "width=800, height=900");
                }
            });

Open in new window


this is your code...
you are getting id... id is only on first row

User generated image
so, remove "houserow" from 2nd and 3rd row..., put only only on first row...
then when we click on first rows, it will work...

second, you are checking "window.opener != null"
on that page, this will be undefined since nobody opened a window...
so, no need to check window.opener...

$("#houses .houserow").on("click", function () {
                //alert($(this).find("td :nth-child(2)").html());
                id = $(this).data("id"); //alert(id);
                url = "http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=y";
                var myWindow = window.open(url, "myWindow", "width=800, height=900");
                }
            });

Open in new window


now, you are getting id, but do not use it and always open id=18!!!
should be

$("#houses .houserow").on("click", function () {
                //alert($(this).find("td :nth-child(2)").html());
                id = $(this).data("id"); //alert(id);
                url = "http://my-friend.co/RegRec2?id="+id+"&user_abbr=mc2&readonly=y";
                var myWindow = window.open(url, "myWindow", "width=800, height=900");
                }
            });

Open in new window

1. I've got a problem to get this ID

id = $(this).data("house_id");

Open in new window


2. Now the problem is that it would go to the detail window "two times" (using current window and new window). How to ensure that it would not do double work?
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many thanks.
How to adjust this

var myWindow = window.open(url, "myWindow", "width=1250, height=1000");

to ensure the window is maximized?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial