Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASPAJAX updating data from the database

Posted on 2010-09-23
8
Medium Priority
?
263 Views
Last Modified: 2012-08-13
Hello,

I want to do something similar that's posted in the following site...
http://classicaspreference.com/aspexamples/inlineajaxedit/default.asp

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.

Thanks,
0
Comment
Question by:andrishelp
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 33749449
Did you get the code from http://classicaspreference.com/aspexamples/inlineajaxedit/codepage.html?  You know there is a database associated with this page too that needs to be downloaded..
0
 
LVL 14

Expert Comment

by:Designbyonyx
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?
0
 
LVL 18

Expert Comment

by:mgfranz
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!

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

The demo runs on all decent browsers.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:andrishelp
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,
0
 
LVL 43

Assisted Solution

by:Rob
Rob earned 2000 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
0
 

Author Comment

by:andrishelp
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.
0
 
LVL 43

Accepted Solution

by:
Rob earned 2000 total points
ID: 33900197
sure you'll only need the "core" that you can download here:

http://mootools.net/download/get/mootools-core-1.3-full-compat-yc.js

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='+element.id+'content='+element.innerHTML,
	update: $(id)
    });

    myRequest.send();
}

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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…

971 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