Program is behaving differently when Submit and $post of Jquery is used
I am going through a confusing situation where when button is clicked a pdf should get downloaded. My design and requirement is something like below:
- Click the button
- show confirm box with two buttons
save
andopen
- If save is selected then pdf should be saved on local computer.
3rd point is where I am facing the problem because when there is no confirm box. Here when form is submitted using submit button
(no confirm box) then file is getting downloaded. Below is code:
<button type="submit" id="Export">xxx_tutorial</button>
But when there is just a button
with onclick
event for confirmation box written in jQuery and I have used $Post
to submit the data to servlet where data is passed to servlet but file is not getting downloaded.
Now my question is:
Is passing the data through
$post
is not equivalent tosubmit
along with passing data to servlet what happens when submit button is clicked.When the data is passed to servlet why file is not getting downloaded where the same code is working when using submit button without confirmation box.
Below is code:
JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/redmond/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<!-- User Defined Js file -->
<script type="text/javascript">
$(document).ready(function(){
$('#Export').click(function(event) {
event.preventDefault();
var currentForm = $(this).closest('form');
var dynamicDialog = $('<div id="conformBox">'+
'<span style="float:left; margin:0 7px 20px 0;">'+
'</span>Open or save the document</div>');
dynamicDialog.dialog({
title : "Open/Save Dialog",
closeOnEscape: true,
modal : true,
buttons :
[{
text : "Export",
click : function() {
$(this).dialog("close");
var data = "xxx_tutorial";
$.post('button', {param: data}, function(param){
});
}
},
{
text : "Open",
click : function() {
$(this).dialog("close");
}
}]
});
return false;
});
});
</script>
</head>
<body>
<button type="button" id="Export">xxx_tutorial</button>
</body>
</html>
Servlet:
package com.testcase.testing;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class button
*/
@WebServlet("/button")
public class button extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public button() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append(request.getParameter("param"));
performTask(request,response);
}
private void performTask(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String pdfFileName="";
if(request.getParameter("param")==null){
}
else if(request.getParameter("param").matches("sap_webi_tutorial")){
System.out.println("in create pdf file name part");
pdfFileName = "/"+request.getParameter("param")+".pdf";
}
else{
}
String contextPath = getServletContext().getRealPath(File.separator);
File pdfFile = new File(contextPath + "/xxx_tutorial.pdf");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename=" + "/xxx_tutorial.pdf");
response.setContentLength((int) pdfFile.length());
FileInputStream fileInputStream = new FileInputStream(pdfFile);
PrintWriter responseOutputStream = response.getWriter();
int bytes;
while ((bytes = fileInputStream.read()) != -1) {
responseOutputStream.write(bytes);
}
fileInputStream.close();
responseOutputStream.flush();
responseOutputStream.close();
}
}
javascript java jquery jsp servlets
add a comment |
I am going through a confusing situation where when button is clicked a pdf should get downloaded. My design and requirement is something like below:
- Click the button
- show confirm box with two buttons
save
andopen
- If save is selected then pdf should be saved on local computer.
3rd point is where I am facing the problem because when there is no confirm box. Here when form is submitted using submit button
(no confirm box) then file is getting downloaded. Below is code:
<button type="submit" id="Export">xxx_tutorial</button>
But when there is just a button
with onclick
event for confirmation box written in jQuery and I have used $Post
to submit the data to servlet where data is passed to servlet but file is not getting downloaded.
Now my question is:
Is passing the data through
$post
is not equivalent tosubmit
along with passing data to servlet what happens when submit button is clicked.When the data is passed to servlet why file is not getting downloaded where the same code is working when using submit button without confirmation box.
Below is code:
JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/redmond/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<!-- User Defined Js file -->
<script type="text/javascript">
$(document).ready(function(){
$('#Export').click(function(event) {
event.preventDefault();
var currentForm = $(this).closest('form');
var dynamicDialog = $('<div id="conformBox">'+
'<span style="float:left; margin:0 7px 20px 0;">'+
'</span>Open or save the document</div>');
dynamicDialog.dialog({
title : "Open/Save Dialog",
closeOnEscape: true,
modal : true,
buttons :
[{
text : "Export",
click : function() {
$(this).dialog("close");
var data = "xxx_tutorial";
$.post('button', {param: data}, function(param){
});
}
},
{
text : "Open",
click : function() {
$(this).dialog("close");
}
}]
});
return false;
});
});
</script>
</head>
<body>
<button type="button" id="Export">xxx_tutorial</button>
</body>
</html>
Servlet:
package com.testcase.testing;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class button
*/
@WebServlet("/button")
public class button extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public button() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append(request.getParameter("param"));
performTask(request,response);
}
private void performTask(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String pdfFileName="";
if(request.getParameter("param")==null){
}
else if(request.getParameter("param").matches("sap_webi_tutorial")){
System.out.println("in create pdf file name part");
pdfFileName = "/"+request.getParameter("param")+".pdf";
}
else{
}
String contextPath = getServletContext().getRealPath(File.separator);
File pdfFile = new File(contextPath + "/xxx_tutorial.pdf");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename=" + "/xxx_tutorial.pdf");
response.setContentLength((int) pdfFile.length());
FileInputStream fileInputStream = new FileInputStream(pdfFile);
PrintWriter responseOutputStream = response.getWriter();
int bytes;
while ((bytes = fileInputStream.read()) != -1) {
responseOutputStream.write(bytes);
}
fileInputStream.close();
responseOutputStream.flush();
responseOutputStream.close();
}
}
javascript java jquery jsp servlets
add a comment |
I am going through a confusing situation where when button is clicked a pdf should get downloaded. My design and requirement is something like below:
- Click the button
- show confirm box with two buttons
save
andopen
- If save is selected then pdf should be saved on local computer.
3rd point is where I am facing the problem because when there is no confirm box. Here when form is submitted using submit button
(no confirm box) then file is getting downloaded. Below is code:
<button type="submit" id="Export">xxx_tutorial</button>
But when there is just a button
with onclick
event for confirmation box written in jQuery and I have used $Post
to submit the data to servlet where data is passed to servlet but file is not getting downloaded.
Now my question is:
Is passing the data through
$post
is not equivalent tosubmit
along with passing data to servlet what happens when submit button is clicked.When the data is passed to servlet why file is not getting downloaded where the same code is working when using submit button without confirmation box.
Below is code:
JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/redmond/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<!-- User Defined Js file -->
<script type="text/javascript">
$(document).ready(function(){
$('#Export').click(function(event) {
event.preventDefault();
var currentForm = $(this).closest('form');
var dynamicDialog = $('<div id="conformBox">'+
'<span style="float:left; margin:0 7px 20px 0;">'+
'</span>Open or save the document</div>');
dynamicDialog.dialog({
title : "Open/Save Dialog",
closeOnEscape: true,
modal : true,
buttons :
[{
text : "Export",
click : function() {
$(this).dialog("close");
var data = "xxx_tutorial";
$.post('button', {param: data}, function(param){
});
}
},
{
text : "Open",
click : function() {
$(this).dialog("close");
}
}]
});
return false;
});
});
</script>
</head>
<body>
<button type="button" id="Export">xxx_tutorial</button>
</body>
</html>
Servlet:
package com.testcase.testing;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class button
*/
@WebServlet("/button")
public class button extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public button() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append(request.getParameter("param"));
performTask(request,response);
}
private void performTask(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String pdfFileName="";
if(request.getParameter("param")==null){
}
else if(request.getParameter("param").matches("sap_webi_tutorial")){
System.out.println("in create pdf file name part");
pdfFileName = "/"+request.getParameter("param")+".pdf";
}
else{
}
String contextPath = getServletContext().getRealPath(File.separator);
File pdfFile = new File(contextPath + "/xxx_tutorial.pdf");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename=" + "/xxx_tutorial.pdf");
response.setContentLength((int) pdfFile.length());
FileInputStream fileInputStream = new FileInputStream(pdfFile);
PrintWriter responseOutputStream = response.getWriter();
int bytes;
while ((bytes = fileInputStream.read()) != -1) {
responseOutputStream.write(bytes);
}
fileInputStream.close();
responseOutputStream.flush();
responseOutputStream.close();
}
}
javascript java jquery jsp servlets
I am going through a confusing situation where when button is clicked a pdf should get downloaded. My design and requirement is something like below:
- Click the button
- show confirm box with two buttons
save
andopen
- If save is selected then pdf should be saved on local computer.
3rd point is where I am facing the problem because when there is no confirm box. Here when form is submitted using submit button
(no confirm box) then file is getting downloaded. Below is code:
<button type="submit" id="Export">xxx_tutorial</button>
But when there is just a button
with onclick
event for confirmation box written in jQuery and I have used $Post
to submit the data to servlet where data is passed to servlet but file is not getting downloaded.
Now my question is:
Is passing the data through
$post
is not equivalent tosubmit
along with passing data to servlet what happens when submit button is clicked.When the data is passed to servlet why file is not getting downloaded where the same code is working when using submit button without confirmation box.
Below is code:
JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/redmond/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.11.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<!-- User Defined Js file -->
<script type="text/javascript">
$(document).ready(function(){
$('#Export').click(function(event) {
event.preventDefault();
var currentForm = $(this).closest('form');
var dynamicDialog = $('<div id="conformBox">'+
'<span style="float:left; margin:0 7px 20px 0;">'+
'</span>Open or save the document</div>');
dynamicDialog.dialog({
title : "Open/Save Dialog",
closeOnEscape: true,
modal : true,
buttons :
[{
text : "Export",
click : function() {
$(this).dialog("close");
var data = "xxx_tutorial";
$.post('button', {param: data}, function(param){
});
}
},
{
text : "Open",
click : function() {
$(this).dialog("close");
}
}]
});
return false;
});
});
</script>
</head>
<body>
<button type="button" id="Export">xxx_tutorial</button>
</body>
</html>
Servlet:
package com.testcase.testing;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class button
*/
@WebServlet("/button")
public class button extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public button() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append(request.getParameter("param"));
performTask(request,response);
}
private void performTask(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String pdfFileName="";
if(request.getParameter("param")==null){
}
else if(request.getParameter("param").matches("sap_webi_tutorial")){
System.out.println("in create pdf file name part");
pdfFileName = "/"+request.getParameter("param")+".pdf";
}
else{
}
String contextPath = getServletContext().getRealPath(File.separator);
File pdfFile = new File(contextPath + "/xxx_tutorial.pdf");
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "attachment; filename=" + "/xxx_tutorial.pdf");
response.setContentLength((int) pdfFile.length());
FileInputStream fileInputStream = new FileInputStream(pdfFile);
PrintWriter responseOutputStream = response.getWriter();
int bytes;
while ((bytes = fileInputStream.read()) != -1) {
responseOutputStream.write(bytes);
}
fileInputStream.close();
responseOutputStream.flush();
responseOutputStream.close();
}
}
javascript java jquery jsp servlets
javascript java jquery jsp servlets
edited Nov 21 '18 at 22:32
halfer
14.7k759116
14.7k759116
asked May 27 '17 at 9:10
SivaSiva
7,77482847
7,77482847
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you submit
the form, the page displayed in the browser will receive the reults of that operation - it's like clicking a link so to say.
Calling $.post()
would instead send data in the background and return the result-data into your callback-function (which is empty in the code you posted). So you'd have to deal with the result in that function.
See post documentation for background
Maybe you could do your logic and then instead of calling $.post()
you simply ubmit the form from within JavaScript code?
Check this for submitting your form directly:
JavaScript post request like a form submit
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44215033%2fprogram-is-behaving-differently-when-submit-and-post-of-jquery-is-used%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you submit
the form, the page displayed in the browser will receive the reults of that operation - it's like clicking a link so to say.
Calling $.post()
would instead send data in the background and return the result-data into your callback-function (which is empty in the code you posted). So you'd have to deal with the result in that function.
See post documentation for background
Maybe you could do your logic and then instead of calling $.post()
you simply ubmit the form from within JavaScript code?
Check this for submitting your form directly:
JavaScript post request like a form submit
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
add a comment |
If you submit
the form, the page displayed in the browser will receive the reults of that operation - it's like clicking a link so to say.
Calling $.post()
would instead send data in the background and return the result-data into your callback-function (which is empty in the code you posted). So you'd have to deal with the result in that function.
See post documentation for background
Maybe you could do your logic and then instead of calling $.post()
you simply ubmit the form from within JavaScript code?
Check this for submitting your form directly:
JavaScript post request like a form submit
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
add a comment |
If you submit
the form, the page displayed in the browser will receive the reults of that operation - it's like clicking a link so to say.
Calling $.post()
would instead send data in the background and return the result-data into your callback-function (which is empty in the code you posted). So you'd have to deal with the result in that function.
See post documentation for background
Maybe you could do your logic and then instead of calling $.post()
you simply ubmit the form from within JavaScript code?
Check this for submitting your form directly:
JavaScript post request like a form submit
If you submit
the form, the page displayed in the browser will receive the reults of that operation - it's like clicking a link so to say.
Calling $.post()
would instead send data in the background and return the result-data into your callback-function (which is empty in the code you posted). So you'd have to deal with the result in that function.
See post documentation for background
Maybe you could do your logic and then instead of calling $.post()
you simply ubmit the form from within JavaScript code?
Check this for submitting your form directly:
JavaScript post request like a form submit
answered May 27 '17 at 9:20
JanJan
12.4k32144
12.4k32144
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
add a comment |
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
Sir thanks for the answer... actually my code for download is in servlet so I have just passed the data to servlet but how do I catch the download file back in jsp is there any way for this, because I tried with javascript but my requirement is I need to have a custom confirmation box which is possible only through Jquery
– Siva
May 27 '17 at 9:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44215033%2fprogram-is-behaving-differently-when-submit-and-post-of-jquery-is-used%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown