473,769 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax Help needed please!!

Hi all,

I'm creating a Php page with connection to a MySql database. In this
page, I get all the articles (text) of a member, and when the article's
length exceeds 500 characters, a link "read more" is shown. I must
implement with Ajax a function that allows, when the link "read more"
is clicked, to show the rest of the article. It's a sort of slide down
function but more complicated I think. I'm a beginner so please can
someone help me with some ideas.

Thanks.

Sep 22 '06 #1
4 1365
ASM
in************* ****@gmail.com a écrit :
Hi all,

I'm creating a Php page with connection to a MySql database. In this
page, I get all the articles (text) of a member, and when the article's
length exceeds 500 characters, a link "read more" is shown.
and what is the href of this link ?

and what is it supposed to happen when link is pressed (without AjaX) ?
I must
implement with Ajax a function that allows, when the link "read more"
is clicked, to show the rest of the article. It's a sort of slide down
function but more complicated I think. I'm a beginner so please can
someone help me with some ideas.
I suppose you need to call the href of your link through an XMLHttpRequest

<a href="more.php? article=245"
onclick="myAjaX Request(this.hr ef); return false;">
read more
</a>

What is it :
http://en.wikipedia.org/wiki/XMLHttpRequest
Simple example step by step :
http://www.webpasties.com/xmlHttpRequest/
And some more ... :
http://www.ajaxtoolbox.com/
http://ajaxpatterns.org/Ajax_Examples
Sep 22 '06 #2
On click on this href, we'll see the entire article.
In fact, when the link "read more" is clicked, we'll have like an
extension of the existing article.

example :

Today, there are too many wars in the worl...
"Read More"
If we click on "Read More" we'll obtain this result :

Today, there too many wars in the world. This is caused by etc etc.

I must have that by an Ajax Function, such as Slide_Down(), seen in
scriptaculos.us
Notice that the article is extracted from the database.

Thanks for your interest.

Ps: Is there any possibility of not using the XmlHttpRequest?

Sep 22 '06 #3
ASM
in************* ****@gmail.com a écrit :
On click on this href, we'll see the entire article.
I undertood :-)
But that doesn't tell how it works (in "normal" mode).
I mean : what the link calls ?
In fact, when the link "read more" is clicked, we'll have like an
extension of the existing article.
Certainly, but that doesn't come by operation of the holy spirit ?
In what I call "normal" mode, the php is doing something : call to MySql
for the complete article and write it in correct place in html code then
send back the entire page completed.
I must have that by an Ajax Function, such as Slide_Down(), seen in
scriptaculos.us
Sorry ... don't know what about you talk.
Notice that the article is extracted from the database.

Thanks for your interest.

Ps: Is there any possibility of not using the XmlHttpRequest?
XmlHttpRequest is part of AjaX ... !
Didn't you ask to work with AjaX ?

I'm afraid your "red more" doesn't work even in "normal" way ?

--
ASM
Sep 22 '06 #4
ASM
in************* ****@gmail.com a écrit :
>
Ps: Is there any possibility of not using the XmlHttpRequest?
In JavaScript You can have in your page your entire article truncated :

<p class="article" >
Today, there are too many wars in the world
<span>...<br>
<cite>
<a href="complete. php" onclick="readMo re(this); return false;">
"Read More"
</a>
</cite>
</span>
<span class="less">
.<br>
This is caused by :<br>
etc <br>
etc.<br>
<cite>
<a href="complete. php" onclick="readMo re(this); return false;">
"Read Less"
</a>
</cite>
</span>
</p>
and in header :

<style type="text/css">
p.article span { display: inline; }
p.article span.less { display: none; }
p.article_all span { display: none; }
p.article_all span.less { display: inline; }
p cite { margin-left: 70%; }
</style>
<script type="text/javascript">
function readMore(what) {
what = what.parentNode .parentNode.par entNode;
what.className = what.className= ='article'? 'article_all' : 'article';
}
</script>

--
ASM

Sep 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1115
by: eric cocozza | last post by:
Hi, I just moved a python program to a new server, and I'm getting path errors. It relys on the pear library and a image processing one. Please respond with cost based on 1/hr of work, and please accept paypal, or other simple form of payment. Thanks!
23
2398
by: Mark Tranchant | last post by:
A new project: http://step-by-step.org.uk/ Don't worry about the links yet, the content hasn't been written. I'm just interested in the introduction screen, which is my first attempt at an absolutely-positioned layout. I'd like to know whether this works well in all browsers. It *should* look like this in a modern, standards-supporting browser:
0
1245
by: Stephen | last post by:
I was wondering if someone could please help me with an array I'd like to create in an asp.net page. I have to design an array which stores the values of addresses manually entered into textboxes (txtAdd,txtCity&txtPostcode). The array must hold the values of these three textboxes. I would like the array to also display these address values in an asp:Lable within a asp:TableCell inside a asp:Table. I want all this to happen on the...
2
1723
by: | last post by:
internal struct ConstantValue { internal DateTime EffectiveFrom; internal DateTime EffectiveThrough; internal DateTime DateValue; internal double DoubleValue; } internal struct Constant {
9
1670
by: silverchrono | last post by:
this is my first semester in C and im trying to figure out how to reset a counter. heres why im trying to do. void text() 59 printf("You can end entering the text by using '#'\n"); 60 int i=0; 61 int j=0;
3
1732
by: OJ | last post by:
Hi, I have written a small C# 2.0 DLL which acts as a client to a Socket based server over the internet. I have written both synchronous and asynchronous methods to connect, send, and receive data from the server. Each request/response can take upto 180 seconds. I am trying to use the asyncronous calls in an ASP.NET C# 2.0 Webcontrol, which displays the returned data. At the moment I am happily using the asyncronous functions and events...
0
1041
by: rodchar | last post by:
hey all, please try 1. drag an ajax update panel onto a new web form 2. put a server-side button in it. 3. and just put in the javascript below in the HEAD section and that's it... i get a error msg: Unknown Error when i hit the button. Intentional: the test function is not wired to anything.
4
1671
by: Dave G | last post by:
I've just been informed that an Access 2003 based system in use at one of my customers now needs to send data in the form of an XML file to a webservice. They told me it was simple - but I don't know anything about it and a googling session yesterday made it look very complicated. So can anyone help with this question - I don't need anything fancy and I haven't got the experience to work it all out for myself from first principles (even...
2
1066
by: na23sh | last post by:
can somebody help me on how to run a visual basic project with a visdata.On a user pc without installing visual basic 6?i have tried the package depolyment wizard but it didn't work?can you help me work with my project.pleassse... Badly needed.
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.