ASPAJAX updating data from the database

Posted on 2010-09-23
Last Modified: 2012-08-13

I want to do something similar that's posted in the following site...

When I copy and paste the code, "EDIT" link does not work. When I click on it, nothing happened.

Anyone please help me, what do I need to change in the code in order "EDIT" link to work.

Question by:andrishelp
  • 2
  • 2
  • 2
  • +1
LVL 18

Expert Comment

ID: 33749449
Did you get the code from  You know there is a database associated with this page too that needs to be downloaded..
LVL 14

Expert Comment

ID: 33749471
That script is using ActiveXObject - which only works in IE... so my first question would be, are you using IE?

Next, in the file 'ajax_example.asp', did you "change the referrer check on line 9" as instructed by the author?
LVL 18

Expert Comment

ID: 33750056
The issue of ActiveX objects is not a problem.  Take a look at this code;

//Browser Support Code
function ajaxFunction(key){
var ajaxRequest; // The variable that makes Ajax possible!

// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;

The demo runs on all decent browsers.
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.


Author Comment

ID: 33753190
The browser is not an issue because I tried IE and FireFox but it still EDIT link not functioning at all.
I changed database to different database.
Next, in the file 'ajax_example.asp', all the referrer code I out it in comment.
Any other suggestions that I can try. PLEASE HELP! Thanks,
LVL 42

Assisted Solution

by:Rob Jurd, EE MVE
Rob Jurd, EE MVE earned 500 total points
ID: 33827366
I would start by making it easy for yourself and use either mootools or jQuery to handle the client side AJAX requests.  Both are well documented and make it easy for using AJAX

Author Comment

ID: 33895882
@tagit: I haven't used mootools before. If you can, would you provide me a some examples that I can start learning mootools and apply to my question? Thanks.
LVL 42

Accepted Solution

Rob Jurd, EE MVE earned 500 total points
ID: 33900197
sure you'll only need the "core" that you can download here:

then you need to reference it in the html header

<script type='text/javascript' src='mootools-core-1.3-full-compat-yc.js'></script>

your edit link would look something like this:

<a href="javascript:EditItem('item1')">Edit</a>

What data is send to your edit.asp script is totally up to you but it will define what 'data' is set to.  for this example i have used the id of the element you are editing as well as passing it's contents.  you might want to set this up differently such as having hidden fields within each element to make it easier to send data back and forth to the server
// a sample function called when clicking EDIT

function EditItem(element) {

    var myRequest = new Request.HTML({
	url: 'edit.asp',
	method: 'post',
	data: 'id=''content='+element.innerHTML,
	update: $(id)


Open in new window


Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question