Welcome Guest, Not a member yet? Register   Sign In
Opening a new page w/ dynamic data
#5

(03-03-2017, 05:04 PM)codeguy Wrote:
(03-03-2017, 03:14 PM)Wouter60 Wrote: Your Javascript has this line of code before the AJAX call:
PHP Code:
window.open('c_tunesheet','_blank'); 
You are not passing any variables (POST or GET) to that url, so the TuneID will be NULL.
The page title will always show up, because you hardcoded it.

Thanks for your reply. This is the full  js/jq function where I assume the problem lies:

   $('.tsEditButt').click(function() { //alert('tsEditButt clicked!');
        var tuneID=$(this).closest('.tune').attr('id');
        window.open('c_tunesheet','_blank');  
        $.post('c_tunesheet',{tuneID:tuneID},function(response) {
            alert('Response: '+response);  // For testing
        });
    });

Can you suggest what I need to do to make this code work? i.e. how do I open the new page and pass the ID variable to it?
It does not work. Window.open open a new window for you with the data from controller c_tunesheet. You do not send any post data to the controller. With the $.post you send an ajax request and get back the value you wanted, but the other window does know about it Smile.

Question:
- Do you need "POST" or can it be "GET"?
- Do you need a new page?
- what do you want?
Reply


Messages In This Thread
Opening a new page w/ dynamic data - by codeguy - 03-03-2017, 10:06 AM
RE: Opening a new page w/ dynamic data - by Paradinight - 03-03-2017, 11:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB