Click here to Skip to main content
12,446,418 members (56,376 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi,

I created a classic ASP page. I capture some data from the 3rd party application using java script. Here I want to store that data into the sql database. After press a button all the values should store in the database. But I can't understand how to do it. Appreciate if any one can help me.

Here is my asp page.

<html>
<head>
<title>Test of disconnection</title>
<meta http-equiv="Content-Language" content="<%=language%>">
<meta http-equiv="Content-Type" content="<%=charset%>">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
 
<style type="text/css">
<!--
    * { margin:0; padding:0; }
    h1 {
	font-family: "Trebuchet MS", sans-serif;
	font-size: 1.8em;
	letter-spacing: -1px;
	background-color: #3f5f91;
	color: white;
	padding: 7px;
	margin-bottom: 7px;
    }
-->
 
</style>
 
</head>
<body onLoad="connectExternal(); startClock();" bgcolor="#ffffff">
<div id="connected" style="display:none;">
<h1 style="color: #afa" >Call connected</h1>
</div>
 
<div id="QueueName" style="display:None;">
<h1 style="color: #afa"> OK </h1>
</div>
 
<div id="disconnected" style="display:none;">
<h1 style="color: #faa">Call disconnected!</h1>
<form>
<input type=submit name="Submit" value="Submit" onclick="--Save Record in Database--"></input>
  </form>
</div>
 
<div id="noconnection" style="display:none;">
<h1 style="color: #ffa">Opened not in Client, will not work</h1>
</div>
 

</body>
 
<script type="text/javascript" language="JavaScript">
<!-- 
 
var ActivePhoneCall;
var QueueName;
var LogonName = "<%=Server.URLEncode(Request.ServerVariables("LOGON_USER"))%>";
 
var handler = function(a1, a2, a3) {
	    alert('Ñïàñèáî!')
}
 
function connectExternal() {
  try {
    ActivePhoneCall = window.external.GetActivePhoneCall();
    if (ActivePhoneCall.CallState != 3) 
      document.getElementById("connected").style.display = 'block';
      AgentName=window.external.GetAgent();
      QueueName=window.external.GetActiveQueue();
      AgentID=AgentName.ID;
      AgentDisplayName=AgentName.DisplayName;
      AgentLoginName=AgentName.LoginName;
      CallType=ActivePhoneCall.Kind;
      CustomerID=ActivePhoneCall.ConnectedNumber; 
      Queue=QueueName.DisplayName; 
      alert(Queue);
      
 
      
  } catch(e) {
    ActivePhoneCall = null;
  }
}
//-->
</Script>

Thank you,
Posted 11-Jun-12 19:10pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Use traditional AJAX for ASP - XMLHttp or ServerXMLHTTP Object.

Refer:
How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object[^]
  Permalink  
Comments
Manas Bhardwaj 12-Jun-12 2:10am
   
Will Work +5!
Sandeep Mewara 12-Jun-12 2:23am
   
Thanks Manas.
Soft009 12-Jun-12 2:47am
   
Thank you for the answer. Can we store data in a database using this method.
Sandeep Mewara 12-Jun-12 3:08am
   
Did you go through the link? You are talking to server from this and thus will be able to save data in database.
Soft009 12-Jun-12 3:10am
   
yes, Ok i'll try it and see whether it works. Thanks a lot. +5
Espen Harlinn 12-Jun-12 8:20am
   
5'ed!
Sandeep Mewara 12-Jun-12 12:54pm
   
Thanks Espen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160811.3 | Last Updated 12 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100