Question

After an interaction i want to refresh the page, and auto select my last selected person in the selection list and set the jquery tab onto the right tab, for example tab 4.

Could someone help me out with this?

Thanks in advance.

Code:

function del_afspraak(id) {
            var antw = confirm("Weet je zeker dat je de afspraak wilt verwijderen?");
            if (antw)
            {
                $.ajax({
                    type: "POST",
                    url: "del_afspraak.php",
                    data: "actie=del&id="+id,
                    success: function(msg)
                    {
                        if (msg=="ERROR")
                        {
                            alert("Het verwijderen van de afspraak is mislukt!");
                        }
                        else
                        {
                            window.location(...);
                            //set the 'default' selectable.
                            //set the 'default' tab-index.
                        }
                    }   
                });
            }
        }

<div style="height: 400px;" class="over">
        <ol id="selectable">
            <?
            connect();
            $result = mysql_query("SELECT id,voornaam,achternaam FROM users WHERE rechten = 0 ORDER BY voornaam ASC");
            while($row = mysql_fetch_array($result)){
                $id = $row['id'];
                $voornaams = $row['voornaam'];
                $achternaams = $row['achternaam'];
                $patient = $voornaams . " " . $achternaams;
                echo "<li class='ui-widget-content' id='$id'>$patient</li>";
            }
            ?>
        </ol>
    </div>

Here above you see how my selectable jquery is build. Basicly it prints out a list of patients. So after deleting an appointment, i want it to auto select the patient + set it on the appointment tab.

Was it helpful?

Solution

If you want to display an updated version of the same page, (ie not a different page), then you can most likely use jQuery/DHTML techniques to selectively update the DOM without refreshing the whole page.

However, if you genuinely need to go to a different page, then you need to pass the patient's id and the required tab index in the URL, and build the new page accordingly:

javascript:

window.location('path/to/otherpage.php?userid=xxxxxx&tabindex=3');

In PHP, pick up these parameters as $_GET['userid'] and $_GET['tabindex'].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top