I have a customer visits list page, in which add visit invokes a bootstrap popup ("#Pop1") to record visit details. In the modal, I have provision to add new customer (on the fly), which in turn opens another popup ("#Pop2") to capture new customer details.
On successful save of the new customer (via AJAX) I show an alert (browser alert) and close new customer popup using $("#Pop2").hide();. On successful save of visit, I show an alert and close the add visit popup using $("#Pop1").hide();.
I have a couple of issues in this context.
(critical) Pop1 -> Pop2 -> Save -> Save. In this scenario, it returns to the listing page, but the page is not accessible. a transparent layer (that came with Pop1) was still overlay on the page. I need to refresh entire page to add another visit.
When I close the Pop2 using close button, it closes both the popups.
Is there a piece of JS or CSS I need to apply to get this work properly?
instead of $("#Pop2").hide(); use $("#Pop2").modal('hide');
same goes for Pop1 also
Related
I have integrated Javascript Messenger & Popup https://github.com/mesibo/messenger-javascript/
I want use Popup Integration or Multitab-Popup for more than one user like Javascript Messenger where we can chat with multiple user (one-to-many)
For that I have display list of users on Page and on clicking on user I am loading popup in iframe with destination user mobile no, destination name and logged in user access token from mesibo.
It is working fine for single user while I am loading second user in iframe then first user getting logged out.
Can anyone please help me with this?
Thanks
You should initialize mesibo only once and not every-time you open a new pop-up. The best place for mesibo initialization is when your page loads.
Your popup code should only have send and receive functionalities. If you are using mesibo popup.html example, you should extract initialization and move it to your main page.
Is it possible to implement this behavior:
I have a HTML link on one page, and after a user clicks on it, it goes to another page which has several tabs on it. Upon clicking on one of those tabs, it triggers an AJAX post call which populates and displays content for that tab.
I would like that when a user clicks a link on the previous page, it takes him to another page and automatically clicks a specific tab so it triggers an ajax call which displays the content for that tab.
This site is a Wordpress site, if that information helps at all.
On the 'from' page you can have links such as
Click Me
You can set an onpage load function to load and use a trigger like this
if(window.location.hash === "#customHash"){
//my custom tab loader
}
You can use jQuery Cookie plugin to achieve this. http://plugins.jquery.com/cookie/
You just set the cookie on the first page, when the user clicks on the link
$.cookie('the_cookie', 'the_value');
And on the next page use the jQuery on load function to check for the cookie.
I am currently working on a project where i can open a child window anywhere within the site, to display order details relating to the logged in user. On one of the pages i need to refresh the data when the window is closed. I have worked out how to refresh the data if the window is closed and the window was opened on that page. The issue i am having is if the child window was opened on a different page and the user navigated to the page that requires it to refresh once the window is shut, i need to obtain the reference to the open child window so i can call my javascript that causes the data to refresh, if the child window is shut.
First its seen little bit tricky..
you declare some ajax function to send information to server whether child window opened or not.. if child window opened then refresh page.
for E.g .
-> assume that user opened 2 same page In different tabs1 and tab2.
-> user opened opened popup window on tab2 and add/change some information..
-> tab2 content refresh as per ur event.
you should also send a one flag to server with session id and tab1 continuous check is that any changes happed to server it will be refresh..
I was able to solve the issue i was having using the code from the following link
Obtain reference to existing browser window
You can open child window with javascript like this.
window.open("ChildWindowURL.aspx?source=windowA");
In the Page_Load of child, you can get the source.
string action = Request.QueryString["source"];
You can send this value to client side with hidden value, and when child window is closed, do refresh or what you need.
I am making a blog app in Django and I want to do the following things
When the user submits the preview button I want to open the partially completed blog in a new tab in the same window.
Secondly if the user does not close the tab and again presses preview button, I want to display the updated blog in the tab which was previously opened.
How can I do this?
Edit:
As told in the answer below I am trying to use this code snippet to open it in a new window, but this does not work
<script>
var current_link = $(location).attr('href');
$('.preview_button').onClick(function() {
window.open(current_link,'preview_tab');
});
</script>
Also I currently have 3 submit buttons and I want to provide this feature only for 1 submit button i.e. preview So I cannot directly do (#form).onSubmit. For the the other two buttons, one updates the content via Ajax and the other redirects to a new page.
Try using a Javascript onSubmit to open the appropriate preview page with window.open, passing a name as the second parameter. It does almost exactly that. (If you want to support having different preview tabs associated with different editing tabs, include something in the name based on a tab ID of some kind -- maybe the article ID plus a random number, or something.)
You'll have to also send the updated content into the server via AJAX.
I have a question on javascript window management.
My application opens an iframe which displays a link. Clicking on the link, opens a popup window, in which I enter my login credentials. My intention is to close the popup window after the login credentials are entered. And this I have been able to achieve using a JS call to self.close().
There after my server side script does some more processing and would like to display the results back in the iframe. This is where things break for me.
The overall flow is as follows:
Iframe Displays a Link --> Clicking on the Link Pops up a window --> Popup Window closes after credentials are entered --> I see my original iframe now (How do I display the contents back in the iframe). Here is the code snippet that closes the popup.
5
6 self.close();
7
The parent of the popup is the iframe. If I modify the above script to give the focus back to its parent, which in my case will be the iframe, will that suffice? Or am I issing something here?
you can access the iframe from your popup by using opener. for example this will reload your iframe:
<script type="text/javascript">
opener.location.href = "htp://mypage.com/myiframe.php";
</script>
you just have to add the right parameters to show what you want to. (of course you have to do this before your self.close();)