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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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.
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.


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 43

Assisted Solution

Rob 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 43

Accepted Solution

Rob 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses how to implement server side field validation and display customized error messages to the client.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

696 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