ASP.NET - Asp to Javascript

Asked By vinayaga moorthi A
09-Feb-10 08:33 AM
  hai

       Still i'm working in asp. My Requirment is i call one javascript, in that javascript i call one more asp.page. in that asp page only contain tha database operation. i select the pariticular value from database, now i want display that value in javascript. PlzHelpme


My Code IS: JavaScript

function hono()
{
  var cid;
  var str_xml="already Exists";
  var str_code1 = document.getElementsByName('customerid')[0].value;
     var str_url1='/karomi/custom/repco-los/search/asp/sample.asp?'+gvar_session_string+'&str_code1='+str_code1;
  //var Jvar = '<%=Str_xml%>'
  //alert(Jvar);
 

          alert('<%=Str_xml%>');
 alert("welcome");

}


And My Asp Code Is:

<%
Dim Str_cid;
Dim Str_res;
Dim Str_xml;
Dim Str_xml1;
Dim x;
Dim obj_xml;
Dim db_name;
Dim rs;
Str_cid=Request.QueryString("str_code1")  // geting from javascript
Response.write(Str_cid)
set obj_con=server.CreateObject("ADODB.Connection")
  
   obj_con.ConnectionTimeout=Gvar_Conntimeout
      db_name ="Provider = SQLOLEDB;User ID=sa;password=theme;Initial Catalog=repos;Data Source=wserver"
   set rs=Server.CreateObject("ADODB.recordset")
   rs.Open "Select customerid from f_hpf_v1 WHERE customerid = '"& Str_cid &"' ", obj_con
           for each x in rs.Fields
             Str_res=x.value
    If Str_res=Str_cid
                Str_xml="UserAlready Exists"
    'Response.Write(Str_xml)
   Else
                Str_xml="New User"  
    'Response.Write(Str_xml)
   End If
     Next
                rs.close
    obj_con.close
              

    'Response.Write(Str_xml)

%>



Thanks

  Sagar P replied to vinayaga moorthi A
09-Feb-10 09:08 AM
Try double qoutes instead of single like;

alert("<%=Str_xml%>");

OR

var v1="<%=Str_xml%>";

alert(v1);


  F Cali replied to vinayaga moorthi A
09-Feb-10 09:10 AM
One way to do it is to load your second asp page in an iframe that's hidden.  Then you can get the innerHTML of that iframe to get the value returned by the page:

function hono()
{
  var cid;
  var str_xml="already Exists";
  var str_code1 = document.getElementsByName('customerid')[0].value;
     var str_url1='/karomi/custom/repco-los/search/asp/sample.asp?'+gvar_session_string+'&str_code1='+str_code1;
 
    document.getElementById("otherPage").src = str_url1;
    alert(document.getElementById("otherPage").innerHTML);

 alert("welcome");

}

<iframe name="otherPage" id="otherPage" width="0" height="0" frameborder="0">

Regards,
http://www.sql-server-helper.com/error-messages/msg-8111.aspx

  Frinavale Soldevi replied to vinayaga moorthi A
09-Feb-10 09:43 AM
Str_xml has been declared but no scope modifier has been used to specify how the variable can be used.

Instead of declaring Str_xml like this:
Dim Str_xml

Try using Public instead (Protected will probably work too) ...like this:
Public Str_xml

Now you should be able to access it properly in your JavaScript function:

function hono()
{
  var cid;
  var str_xml="already Exists";
  var str_code1 = document.getElementsByName('customerid')[0].value;

//The following line might be causing you problems too. I don't see where you've declared gvar_session_string....
  var str_url1='/karomi/custom/repco-los/search/asp/sample.asp?'+gvar_session_string+'&str_code1='+str_code1;

  alert('<%=Str_xml%>');
  alert("welcome");

}

-Frinny

  vinayagq replied to Frinavale Soldevi
20-Mar-10 05:16 AM
Hai
   i try to send email using the vbscript .It say error
http://forums.devshed.com/asp-programming-51/activex-component-can-t-create-object-cdo-message-283774.html
MyCode IS

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "thivinayagam@gamil.com"
objMessage.To = "moorthi@themetechnologies.com"
objMessage.TextBody = "This is some sample message text."

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
A

Create New Account
help
Help me. . . . . . hi all, i just want to say that actually i am new to asp.net 2.0 i have a work over my head and really m not knowing how xhtml1 / DTD / xhtml1-transitional.dtd"> < html xmlns = "http: / / www.w3.org / 1999 / xhtml" > < head runat = "server"> < title > Login < / title > < / head > < body > < form id = "form1" runat = "server"> < div > < / div > < table cellpadding = "0" cellspacing = "0" border = "1" align = "center" style = "width: 483px; height strong > < / td > < / tr > < tr > < td align = "center" style = "height: 30px; width: 384px; background-color: ActiveBorder" > < asp : Label ID = "lblUserID" runat = "server" Text = "UserID :" ForeColor = "#003300" > < / asp : Label > < / td > < td align = "center" style = "height: 28px; width: 312px; background-color: ActiveBorder" > < asp : TextBox ID = "txtUserID" runat = "server" style = "z-index: 100; left: 274px; position: absolute; top: 53px
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B)What is a objects in Remoting? (A) What are the ways in which client can create object on server in CAO model? (A) Are CAO stateful in nature? (A) To create objects in CAO A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP
Products”) DataGrid1.DataSource = ds.Tables(”Products”) What is the maximum length of a varchar in SQL Server? Answer1 VARCHAR[(n)] Null-terminated Unicode character string of length n, with a maximum of The presentation logic is done with .aspx extention. How do you define an integer in SQL Server? We define integer in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much