473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Using AJAX to refresh part of page

22
Hi, I'm looking for a way to refresh just one part of a page (a div layer) rather than the entire thing. It has been suggested to me that i use AJAX to do this - however I have no knowledge whatsoever of this. Could someone confirm that this could be done and point me in the right direction?

Thanks....
Nov 14 '06 #1
7 47907
ronverdonk
4,258 Expert 4TB
Yes, you can do that using Ajax. It can be triggered using a Javascript event.

See thread http://www.thescripts.com/forum/thread561233.html for a complete discussion about and a solution for dynamically populating drop-down lists using Ajax.

Especially post number http://www.thescripts.com/forum/post2198507-5.html shows some sort of process overview of this solution.

Once you have read that, you'll better understand the possibilities for your situation.

Ronald :cool:
Nov 14 '06 #2
Luongo
22
Thanks ronverdonk.

Along these same lines, though more specific, is it possible to submit a form and have just that layer refreshed? I saw in your discussions the use of a select box that would display info onChange. However, in one case, I'd like to be able to actually pass values (hidden values and the coords_x/coords_y values on an image input type) without refreshing the entire page as mentioned. Can this be done using the methods you described in earlier posts? Thanks...
Nov 14 '06 #3
ronverdonk
4,258 Expert 4TB
When passing values in a regular form, you can simply create a button or image element that will automatically pass all values of a form to the script designed by the action attrib of the form tag.

In general, such a solution bundles up all values and then passes them on to said script with little or no interaction necessary on the part of the developer.

Submitting a form via Ajax en then passing the values to a script is a touch more complicated.

So in short: yes you can submit a form using Ajax, but it comes at the cost of - not to be underestimated - additional complication.
Question is: is the result worth the effort?

As to the last question: you can pass any value from a DOM reachable field to the server using Ajax, but to start the process you'll need some sort of trigger (such as a Javascript event).

Ronald :cool:
Nov 14 '06 #4
ronverdonk
4,258 Expert 4TB
Continuing my revious post:

For Ajax form submissions there is an Ajax toolbox available, that may (or may not, I haven't looked closely into it) assist you in your decision to use form submission via Ajax. See link Ajax Toolbox section 'Sample', 'form submission'.

Ronald :cool:
Nov 14 '06 #5
Luongo
22
Thanks again Ronald. I have managed to get a test form up and running using these methods. However, one problem I cannot solve is how to pass the coords_x and coords_y values of an image input type through ajax. Usually an image submit button would submit the form and also generate those coordinate values. However, with Ajax it just seems to submit the form. I will continue searching, but if you know of a way around this please let me know.
Nov 15 '06 #6
ronverdonk
4,258 Expert 4TB
Is it not possible to issue an GetImageSize($image) command on that image and store the values for H and W in the form somehow?

Ronald :cool:
Nov 15 '06 #7
Luongo
22
Yes, but what I need is the exact coordinates where the image is clicked, which is what the coords_x and coords_y values of the input provide. Do you know of a different way I could get these coordinates and store them as hidden values, rather than having to wait until the form is submitted?
Nov 15 '06 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: JMB | last post by:
Hello, I was wondering if anyone knew of any projects extending the inline upload progress bar to utilize an inpage image uploader with bar, without having to refresh or go to a seperate page,...
1
by: Jim | last post by:
I am having difficulty on maintaining session when using ajax. I first load a page with a session genterated. But since AJAX is a client side activity where I sent an AJAX request to an url...
4
by: Tami | last post by:
Hello, I could use some advice on the best way to connect to some php in my source code using ajax. So that the php will re-execute after so much time with a script elsewhere on the server. Please...
4
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to submit the form with...
10
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
25
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
6
by: John Doe | last post by:
Here's my issue: I have an instant messenger type feature for my site, its basically an ajax IM feature. I run with a mysql backend on the site, i have a div on my main page that runs a javascript...
5
by: Kaante | last post by:
Hi, I basically have two frames on my page, the top one contains users stats and the bottom frame contains the website. I want to have a message icon on the top frame which would flash once the...
5
by: SAM | last post by:
Mtek a écrit : no, that is the code given to the server we need the code received by the browser (snip) you'll certainly need Ajax or to send the form and get-it back
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.