Launching a new window upon page load in ASP.NET with the POST method

I am looking for a way to open a pop up in asp.net using the post method and window.open to resize the new windows.

Here is my code:

To open the pop up:

function openPopup(URL) {
    child = window.open(URL, "popup","dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=475");
    child.location.href = URL;
    if (child.opener == null) {
      child.opener = window;
    }
    child.opener.name = "opener";
  }

URL:

function PaymentOnline(Bank)
{
    switch(x){
        case "BCH":
            document.frmEnvia.action = SERVICE_URL + "/callcom.asp";
             url = SERVICE_URL + "callcom.asp
             alert(url);
             openPopup(url);
             document.frmEnvia.submit();
            break;
    }    
}

ASPX:

<body>
    <form id="frmSend" runat="server" name="form" method="post" target="_blank">

    <div style="visibility:hidden;">
        <asp:TextBox ID="txtXml" runat="server" Visible="true" />
    </div>
    .....    
</body>

On page load (code behind), I create an XML string and put it in the txtXml textbox.

I need to use the post method because the server validates the method, and window.open because I need to customize the pop-up window.

Thank you!

Answer №1

My suggestion is to make some changes to the object:

parentWindow

Embedded within the document object, prior to form submission; for instance:

switch(x){
    case "BCH":
        document.frmEnvia.action = SERV + "/llamacom.asp";
         url = SERV + "lamacom.asp
         alert(url);
         mdpbch(url);
         //at this point, you can modify the parentWindow element
         document.parentWindow.scrollbars... (include necessary attributes)
         //--
         document.frmEnvia.submit();
        break;
}

Answer №2

If you assign the popup's name as passwd, then you should also adjust the form's target attribute to match it - in this case, to passwd.

The modification required is simply:

<form ... target="passwd">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Designing geometric forms using the vertices of a Sphere in ThreeJs

My current project involves creating shapes based on vertices that have already been generated using a formula. I have successfully connected lines between these vertices using a threejs method, but now I want to take it a step further and create map tiles ...

How can we verify email addresses and URLs in PHP? Let's discuss converting this validation process

After studying the code extracted from the jquery.validate plugin, I find it quite challenging to decipher. My goal is to convert this code into PHP and I would greatly appreciate any assistance in understanding each segment of the regular expression codes ...

Loading menu items into MUI Select from a JSON file

Looking to dynamically populate an MUI select with choices retrieved from an API's JSON response. Currently, all Choices are being inserted into a single MenuItem within the Select component. Considering that the Choices may change in the future, I&a ...

Update the appearance of an element in real-time using VUEJS

I am trying to use VueJS to dynamically change the position of a div. In the data function, I have a variable called x that I want to assign to the top property. However, the code I wrote doesn't seem to be working. Here is what it looks like: <tem ...

Implementing default header and footer with Angular's ui.router

When dealing with ui.router modules, I have identified three different methods for setting a default header and footer for every view: DEFAULT HEADER <CONTENT> DEFAULT FOOTER 1. Using ng-include - inserting your header/footer in the initial .html ...

What is the best way to access the following element of an array within a for..of loop with an if statement in Javascript?

Need help with creating a word filter that checks if index 1 is 'dog' and index 2 is 'cat' in an array. What should be checked in the next index for 'word'? let textContainer = ['bird', 'dog', 'cat& ...

Tips for retrieving data from a JSON response with the specified structure

When I make a request, the response is as follows: { "data": [ "http:\/\/www.domain.com.br\/anunciantes\/jorgediaz.y.com.r\/26\/img1.jpg", "http:\/\/www.domain.com.br\/anunciantes\/jorg ...

Is it possible to transmit an array using $.ajax and specify the dataType as json?

I am currently attempting to send a JavaScript array to my .php file handler and store it in my database. Although the request is successful, it seems like my array isn't being posted/saved correctly. When I check the POST request source, it shows up ...

Is it possible to switch out all instances of "GET" methods with "POST" throughout the codebase?

While working on a web application, we encountered caching issues with Internet Explorer (caching occurred due to the use of GET requests). The problem was resolved when users turned on "Always refresh from server" in IE's Developers Tool. Although we ...

Can CSS be used to communicate to JavaScript which media queries are currently in effect?

Is there a way for Javascript to detect when a specific CSS media query is active without repeating the conditions of the media query in Javascript? Perhaps something similar to an HTML data attribute, but for CSS. For example: CSS @media (min-width: 94 ...

jQuery is currently displaying the value stored in the variable in a phrased format

Having trouble with the initial phase of a major project. I am attempting to showcase the JSON output received from the URL below. It displays the data perfectly when I directly enter the URL into a web browser. However, when I assign the URL to a variable ...

Utilize jQuery ajax to target a particular recurring input

I am using HTML code along with another jQuery loop. Within this loop, there is an input element that is also being looped. I am trying to manipulate it using jQuery Ajax... but I am facing an issue where only the first input element works properly. The re ...

Develop an ASCX component to handle various tasks

I am currently in the process of developing a unique custom control that will feature two radio buttons. This project is being carried out using MVC4 and ASP.NET technology. At the moment, I have successfully created two sets of two radio buttons on separa ...

Avoiding Rejected Promise: Warning for Error [ERR_HTTP_HEADERS_SENT] due to Issue with setInterval and Axios.post Error Management

I attempted to address this warning by researching online. Unfortunately, I couldn't find a solution, so I am reaching out with this question. The current warning that I am encountering is: (node:39452) UnhandledPromiseRejectionWarning: Error [ERR_H ...

Tips on showcasing a collection of orders stored in a database using Vue.js

After successfully updating my orders post payment, I am wondering how I can showcase them on my Vue front end. Below is the HTML template displaying the list of orders made: <template> <div> <div v-for="order in orders&quo ...

What steps can be taken to make the carousel inconsistent when relying on the assigned id in props?

I recently developed a slider with slots, but encountered an issue. The code for this component revolves around the use of IDs for each slide as prop, making it unnecessarily complex. I am convinced that there is a more straightforward way to achieve the s ...

What is the best way to make IE reload a flash.swf file each time the page is accessed?

Upon visiting our site, users are greeted with a dynamic coverflow display. For those who are not logged in, the images remain invisible. However, upon logging in, users should be able to see the images in the coverflow. Unfortunately, due to caching, the ...

Receiving JSON data from the server, but struggling to render it as HTML using Jquery

Currently, I am in the process of developing a mobile app and have created a PHP API that extracts data from a MySQL database and encodes it into JSON format. To display the records from the JSON output, I use jQuery AJAX to call this API and render the d ...

Mobile Devices Image Gallery Optimization

Just starting out with HTML, CSS, Bootstrap, and JavaScript and I've put together this gallery. It looks good, but I need to optimize it for mobile devices and smaller screens. Any suggestions on what I should change? For items #myImg4, #myImg5, #myI ...

What is the solution to prevent the div tag from being empty within Jquery UI Tabs?

I found this example that I am currently following: http://jqueryui.com/demos/tabs/#ajax After clicking on Tab1 and Tab2 in their example, the text disappears immediately, and the div box shrinks before new data is loaded. Is there a better way to handle ...