JQuery :: Retrieve String Dynamically Generated On The Server Side?

Dec 16, 2010

From WebForm1.aspx, I have successfully retrieved a string that is dynamically generated in WebForm2.aspx and spit out to a Literal control in a div. This is what I did.

//In WebForm1.aspx, I have:
$.post("WebForm2.aspx", { para1: "value1", para2: "value2" },
function(data) { $("#mydiv").html($("div#div1", data).html()) });

That's pretty simple and easy to understand for you jQuery gurus out there.

Now, I am trying to do the same thing within the single web form. That is, in WebForm1.aspx, I have this jQuery script to post to the same web form (i.e., WebForm1.aspx), but it is not working. Postback works OK, but I am not able to retrieve the dynamically generated string and spit it out to mydiv.

What's the jQuery way to do this? Any example? I searched, but I've only found examples which try to get static string values, which I know how to do.

View 24 Replies


ADVERTISEMENT

Ajax :: Write String To IFrame As XML Without Server-Side Scripting

May 13, 2011

I am trying to write a string variable containing XML in the form of text into an iframe such that it shows up as formatted XML with the expand(+) and collapse (-) options that default in IE when opening an XML file.

The first thing I tried is writing the string to a file with .xml extension and setting the iFrame src to that file. This works well normally, however in this case, the file does not get created where I want to due to some security restrictions in IE which I cannot edit as I dont have admin rights.

Secondly I tried appending the string as innerHTML to that iframe but only the content within the XML tags without any formatting shows up which is not intended.

Thirdly I cannot use any server side scripting as this is a very controlled environment and I am not allowed to host servers or edit server scripts at will. This is totally out of question, so I guess Ajax or calling a costom defined web service wont help.

At best I can say, I am limited to HTML, Javascript and vbScript.

I am receiving the string as a responseText from an ajax request which is consuming a web service. If I use responseXML, it doesn't work.

The solution I am looking at is to either display it as formatted XML in an iFrame or to just throw it into a textarea which I am already doing and simultaneously write it to an XML file or do both. If not automatically, atleast have the user press a button and do it.

View 4 Replies View Related

JQuery :: Encode/decode Of JSON - Server-side And Client-side?

May 26, 2009

I am building a client-side and server-side solution and want to use JSON through Ajax in both directions. I have ASP or JavaScript server-side, though Microsoft's support of server side JavaScript seems nil, so I am reluctantly conceeding to use ASP. I'd appreciate suggestions on available solutions to encode/decode JSON on the server-side (ASP or JavaScript). I don't plan to load jQuery server-side so that rules out plug-ins. I'd also like to know what is the latest client-side encode/decode for JSON. Is it built in jQuery or a plug-in? In both server and client, decoding JSON securely is key, so using eval () to decode is out.

View 1 Replies View Related

Passing Values From Client Side To Server Side Python Script

Jun 1, 2009

I am developing a web form using python cgi which has two list boxes. On selecting a value from the listbox1, the list box 2 should get auto populated with appropriate values (which are taken from the DB). I have written a javascript function to get the selected value from the list box1. But I am struck with passing the values from the javascript to the python function written in server side in which I have written the DB related stuffs.

View 1 Replies View Related

Sending Values From Server Side To Client Side Javascript

Jul 20, 2005

I have a Hyperlink within a String like below:

sSql = "SELECT DISTINCT " + "'Action' = '<center><a
href='+char(34)+'ChangeRequest.aspx?ID='+cast(Chan geRequest.ChangeRequest_ID
as nvarchar) +CHAR(34)+'>Open</a></center>',"

I want to invoke a Client side javascript function and pass the value
of the ID. How can I accomplish this such when a user clicks "Open" he
goes to a new window with the same ID.

I tried this but it does not work:
On Server side:
sSql = "SELECT DISTINCT " + "'Action' = '<center><a href= 'javascript:
NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
CHAR(34)+)'>Open</a></center>',"

On Client side:
function NewWindow(myID)
{
window.open("ChangeRequest.aspx?ID="+myID,"WindowName","width=500,height=600");
}
</script>

View 1 Replies View Related

Pass Parameter From Server Side Php To Client Side Script?

Aug 22, 2011

On the server side I have a php generated session parameter.
I need to pass it to javascript on the client side page.

I saw on the web the following solution code...

I tried it but it did not work.

View 1 Replies View Related

Adjusting Code To Use Either Server-side Or Client-side Validation--NOT BOTH?

Sep 11, 2009

I have the following PHP code, which uses server-side validation, which works fine. It the user leaves the text field empty it stores an error in a session array which is outputted on the page where the $_GET['id'] variable came from. I also implemented a snippet of javascript code that just checks to see if the cell is empty and throws up alert box. The problem is that both the javascript code and php error validation are both running when I click submit. The PHP code should be a backup to the javascript code in case the user has javascript turned off. The client-side validation should be the default. Not sure if this change should be made in my PHP Code or Javascript Code.

PHP CODE:
session_start();
require_once("../Modules/Connection_Functions.php");[code].....

View 1 Replies View Related

Client Side Script With Server Side Controls

Jul 20, 2005

I have a web form that has a checkbox on it and a textbox associated
with it. I want the textbox to be displayed when the checkbox is checked
and I want this to happen on the client-side instead of posting back to
the server. The checkbox is a server control (asp:checkbox...). I can
write some codebehind that will display an alert message upon checking
the box that looks something like this...

Page_Load...

Dim s As String
Dim scriptString As New System.Text.StringBuilder

chkExpDate.Attributes.Add("onclick", "alertmsg()")
scriptString.Append("<script language=JavaScript> function alertmsg()
{")
scriptString.Append("alert('hi'); }<")
scriptstring.Append("/" + "script>"
s = scriptstring.ToString()

Page.RegisterStartupScript("startup", s)

End Sub

I used this as a test to make sure the server control was running the
script. But, when I change the script to assess the value of the server
control checkbox such as checked = true, I get errors and if I just try
to display the asp:textbox, it doesn't work either.

View 1 Replies View Related

Server Side Or Client Side Validate?

May 14, 2007

I had a import function which allow for user import data from excel file. The number of row was dynamic, mean that user may import hundred or data or may thousand of line.

should i perform client side or server side validate?

the problem i faced was if the import thousand of line, i need display out thousand of text (multiple by 6, cause 1 got 6 fields)

the take a lot of time to loading and cause browser "hang" (response slow)

any solution for me?

View 13 Replies View Related

Converting Client Side CMS To Server Side?

Jun 16, 2010

I have the following client-side Content Management System VBscript which works great, now I'm looking at getting it to work server side so that I can update using online login rather than offline and having to upload files. To be honest, I have no idea where to begin with this,

Here's the full VB script:

[Code]...

View 1 Replies View Related

AJAX :: Getting Server Date/time With No Server Side Script

Apr 19, 2010

I'd been looking for some way to get server date/time without using any server side script (such as ASP, PHP, etc).

I found this and it worked just excellent for me! I just want to share it because it wasn't easy to find.

I created a js document with code:

Code:

Now, I can use this js within a html like this:

HTML Code:

You may change your machine date/time and check both dates.

View 1 Replies View Related

Dynamically Change Row Colour On Dynamically Generated Table Rows

Nov 25, 2005

At this point I have been able to add the row. But what I want to do and am having trouble with is alternating the row colour to the dynamically added row element.

Sample of code I am using:

Code:
var tbody = document.getElementById('tableItems');

var row = document.createElement("tr");

var remainder = tbody.rows.length % 2;
if(remainder) {
row.setAttribute("class", "rowLightGreen");
}

var td1 = document.createElement("td");
td1.appendChild(document.createTextNode(qty));
td1.setAttribute("class","qty");
row.appendChild(td1);
tbody.appendChild(row);
One thing that puzzles me, is that even after adding a row the table my table.rows.length still = 0.

Does anyone know how I can determine the appropriate amount of rows so that I can apply the appropriate class?

Or is there just something blatantly wrong in my approach?

View 2 Replies View Related

Events - Add Server Control To Custom Webcontrol That Fires Function And A Server Side Function?

Jun 24, 2010

In ASP.Net, I am trying to create a WebControl. In this control, I have RenderControl method overridden with my html controls.

protected override void RenderContents(HtmlTextWriter output)
{
output.Write(@"<table><tr><td>");

[code]....

How can I make the button call the click event so that the server side method btnExecute_Click() can be called? Also, this button calls a javascript function before server side even.

View 5 Replies View Related

JQuery :: Retrieve Server Response After Submitting Form In HTML?

Dec 28, 2011

I have designed a form as below

<form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/XXXXXXXXXXXX" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_top" >
<input name="item_name_1" type="hidden" value="Test Product"/>
<input name="item_description_1" type="hidden" value="Test Product of my cart"/>

[Code].....

On hitting the button one new window is getting opened with response URL from 3rd party(in this case Google Checkout). But for me i need to open this in a inline-popup (lightBox, ColorBox etc...) rather than new window. In the form definition, i have replaced mymerchant_idwith 'XXXXXXXXXX' for privacy purpose

View 1 Replies View Related

JQuery :: Datatables - Server Side Processing PHP

Jan 21, 2010

I try this sample [URL], where data is procesed on server. I prepare tables in DB and data. and nothing isn't displayed in datable? Then I create same server_prcosing php and I checked syntax from php it was OK same as json, but jquery.datable did not process any data on screen.
source:

style type="text/css" title="currentStyle">
@import "css/demo_page.css";
@import "css/demo_table_jui.css";
@import "css/smoothness/jquery-ui-1.7.2.custom.css";
</style>
<script src="lib/jquery.dataTables.js" type="text/javascript" language="javascript"></script>
$().ready(function() {...

$("#example").dataTable({
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "SearchForms/server_processing.php"
});
});

View 5 Replies View Related

JQuery :: Add A Server Side Method To The Validator?

May 13, 2011

i'm trying to add a server side method to the jquery validator. my code is:

$.validator.addMethod("existing
",function (value){
$.ajax({url:"ajax.php",data: value,type:"POST"
,async: false, dataType: "text" }).responseText ==

[Code].....

View 2 Replies View Related

JQuery :: Calling ASP.Net Server Side Event From Dialog Button?

Feb 11, 2010

My javascript code

<script type="text/javascript">
$(document).ready(function() {
$('#dialog').dialog({
modal: true,

[Code].....

How to invoke this server side button click event from the jquery dialog ok button

View 4 Replies View Related

JQuery :: Initializing Data Method Variables On Server Side?

Feb 8, 2010

You can use JQuery's data method (e.g. $('#MyID').data('MyVar', 'MyValue');) to easily store/retrieve information.

However, I was wondering if it is possible for my PHP generated page to add HTML tags that initialize the JQuery's data method variables. Regularly, I want server side variables to be accessible client side. It would be very helpful if I could initialize data method variables during PHP page generation.

If this is not possible, are there any suggestions on how to efficiently communicate server side variables to client side?

View 3 Replies View Related

JQuery :: Show Server Side Process On The Client Using Ajax?

Feb 22, 2010

My login to the site is being processed using ajax, which does a redirect to the members page upon succesfull loggin in.The login feature however can in fact take a while because we need to initialise quite some data when a user logs in (his details, but also his privileges are loaded, his personal menu based on these privileges are being loaded, we are loading shopping cart info, we are initialising personalisation settings, and a whole lot more.It sounds like a big thing, but it isn't, and once logged in, the application is going great. the only thing is that the login proceure can take 3 - 4 seconds, and I would like to be able to show the client the progress of the serverside script:

"Searching your account..."
"Validating your privileges"
"Initialising your personal menu"
blablabla...

To do this, I might just call an ajax call that starts the login procedure, and then issue another ajax call every 1 second or so to update the status based on some session variables I set in the login procedure and that I can serve to the client when th next ajax calls come in, but I would love for this to work a little nicer as in just needing to initialise ONE ajax call which can send back statusupdates from the server...

View 1 Replies View Related

JQuery :: Get Dynamically Generated ID By Class Name?

Sep 1, 2010

I'm stumped on a jQuery related development task. I'm using jQuery in a SharePoint Web Part...The web part pulls data from a list and displays each item as a link button. When the link button is clicked it uses the jQuery-UI to display the body of the list item in a dialog box. I have this working perfectly when all of the class names are hardcoded. So in this code dialog0 is the class name for the body of the first article. newTitle0 is the linkbutton so they correspond 1:1 (and so on Dialog1, newsTitle1 etc..)

$('.dialog0').dialog({
height: 500,
width: 990,
autoOpen: false,

[Code].....

Problem is, when I have more than 1 instance of the web part on a page, because they use the same class names (2nd web part would also use Dialog0, newTitle0), if I click on an item in one web part, the item with the same class name opens in the other web part as well.

I've implemented it so each item now has a unique ID but I don't know where to go from here, so multiple instances of the web part can be on the page, and have the jQuery know which body to display when a link is clicked.

View 7 Replies View Related

JQuery :: Auto-Complete Sends Null To Server Side Function?

Oct 7, 2009

I'm using the AutoComplete Plugin with ASP.NET MVC For some reasonthe client side input value is NULL when it reaches the Server method.

View 2 Replies View Related

JQuery :: Bind With Parameters - Replace Inline OnClick For Server Side

Jul 2, 2009

Is there a way to do this for a while. Say I have a dynamic page that generates some td elements. The syntax here is freemarker but you can easily envision your favorite serverside text generating language instead.

<table id="records">
<thead><th>Name</th></thead>
<tbody>
[#list records as record]
<tr>
<td class="trigger" id="trigger_${record.ID}" onclick="showDetails
(${record.ID})">${record.name}</td>
</tr>
[/#list]
</tbody>
</table>
<script type="text/javascript">
function showDetails(recordID) {
// normally an ajax post but you get the idea
window.location = '/record?recordID=' + recordID
}
</script>

Now I want to get that onclick out of there and bind it using jquery, but I haven't been able to figure out if there is a way to get the parameter there. Apart from putting it in some attribute and looking at it. Is there a cleaner way?

<script type="text/javascript">
$(document).ready(function() {
$('#records td.trigger').click(function() {
window.location = '/record?recordID=' + ??? how do i get that
});
});
</script>

I know I could look at the elements attributes, something like this.attr("id").substring().etc().etc() .. but sometimes there are many parameters to the javascript fn to generate the post and that approach doesn't seem to viable. and there isn't really a standard attribute to use that makes sense for that anyway.

View 5 Replies View Related

JQuery :: Send 3 Text Box Values To Server Side Method Ajax?

Apr 14, 2010

I want to send three text box values to server using jquery ajax. problem is that, i dont know the exact syntax to send three data. When i try sending one data(also change no.of parameters to one at server side method), its going good but when i try to send three text box values, its giving jquery error:"Internal server error". I think I am not sending data in correct way. Example below contains only two sending data, because i was trying to send 2 data first.

Below is the code:

function testCAll() {
$.ajax({
type: "POST",
url: "dbTest1.aspx/SendMessage",

[Code]....

View 2 Replies View Related

Jquery :: JSON Submit - Decode Empty Array At Server Side

Feb 22, 2011

I am doing a password reset form using Jquery and PHP. If I try to submit an email id it should sent and email and report back the response text as success so that the user knows email has been sent. But I am stuck with JSON submit as I have an empty array to decode at the serverside. I am using minified version of json2.js from the official json.org website

Here is the code.
Code JavaScript:
var formdata = $("#log-box").serializeArray();
formdata = JSON.stringify(formdata);
var notifymsg;
alert(formdata);
$.ajax({
type: "POST",
url: "forgot-pass.php",
contentType: 'application/json',
data: formdata,
success: function(responsedata){
var some = responsedata.split("&");
$.each(some, function(index,value){
//alert("index="+index+"value="+value);
});
},
error: function(o, s, e){
alert("Form not posted
"+e);
}});
formdata alerted gives:
[{"name":"email","value":"ravi.k@gmail.com"},{"name":"acctype","value":"loginaccount"}]

PHP forgot-pass.php
Code PHP:
print_r($_POST);
Gives
Array(
)

View 3 Replies View Related

JQuery :: Reload Content In A Div That Is Generated Dynamically?

Oct 22, 2010

I have a jsp file that is used to display data from Java objects running on my server. I'm using JQuery for tabs and to handle the ajax calls to a servlet that affects the Java server I have running.Each tab represents a service, and has a corresponding java object on the server side. These are generated from the spring configuration, and is working fine. The page is used to control some aspects of the service, and I have a few buttons that can be clicked. I'm trying to get it so that when a button is pressed, the appropriate Java function is called on the service's object (this happens using ajax) and then refresh the current tab.

My js code is like this:

function doPause(params) {
//some additional params set
doAjax(params);

[code]....

Right now, I'm using the window.location.reload(true) to refresh the whole page but I'd like to just redo the div for the tab that contains the button that has been clicked.I have tried:

$("#"+params.client).load("monitor.jsp#"+params.client);

instead of the window.location calls above, but that puts the whole page into the tab.

View 1 Replies View Related

JQuery :: Validating Dynamically Generated Fields

Dec 3, 2010

I'm trying to validate a set of dynamically created field names, for example

Name: <input type='text' name="s1[name]" id="s1[name]">
Image: <input type='text' name="s1[image]" id="s1[image]">
Name: <input type='text' name="s2[name]" id="s2[name]">
Image: <input type='text' name="s2[image]" id="s2[image]">

[Code].....

There can be any number of 'groups' but I would want to apply some validation for each item in a group. I can only see that the validation is done by specifying a id? however as the id's are going to be dynamically created how can I do this? can you validate for a css class?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved