Jul 9, 2008

Ajax question

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > AJAX

free web hosting

Ajax question

sonesay
I have a general question about how ajax updates div's. Have you ever wanted to update a element inside a <div> but not nesseary update the whole div?
here is an example
CODE
echo "<div id='heading_general'>";
echo "<h4>General <span id='general_total'>0</span> <button id='btn_general' onclick=\"tv('general_merits','btn_general');\">-</button></h4>";
echo "</div>";

like if I tried updating the span id of 'general_total' it will work but the output will be put on its own line so it messes up the format. the only other solution I have to this is updating the whoole div 'heading_general' and it will all be outputed to one line. I'm sure you can see the reason for this you will only update 1 element and not have reload all.
Notice from jlhaslip:
Split, Edited, and Moved to Programming/Other
Please do not post into a Member's Application for Hosting Thread.
Thanks.

 

 

 


Reply

truefusion
I can understand the reason on why you would just want to update one element, but i'm trying to figure out why it places everything on its own line. I can only come up with a few reasons:
  • There's a BR or P element within the new output.
  • There's too much text in the element.
  • It's a browser specific problem.
Does it meet any of these?

Reply

sonesay
The output was just an echo of "1"; I just did that to test out to change the original value of 0 to 1.

I dont think it gets put on a new line because of insuficent width space. because the final output is like this.
'General'
'1'
'<button>'

when the original output is
'General' '1' '<button>'


I tested it out on fire fox, safari and opera i believe and it does have the same effect on all 3.

I am using a DTD of strict xhtml 1.0 maybe that has something to do with it. At this stage I'm happy with reloading an entire div just to keep moving forward on my project. Hopefully someone with similar issues or know a way do this method can let us know. I have posted this issue on ext forums but no response so far over there.

thank you again for your response.

Reply

galexcd
Try adding this to your span tag:
CODE
<span id='general_total' style="display:inline">0</span>

(either change the quotes to single quotes or escape them out if you are going to use that echo statement)

I hope this fixes it smile.gif

Reply

sonesay
sorry for late reply. I already went with just full div reload and I dont have my previous versions of it backed up to test out ; ; . This does look like it will work though ajax is whacked in messing up displays I remember I had similar problems in the past and putting inline styles did work to some extent. If anyone is working with sometime similar try what alex pointed out. If I do come across this bridge again i will probbaly give it another go.

heres my final merit system now http://sonesay.trap17.com/char.php I probably wont do any more work on there It was only ment to be a test for my database structure and its seems sufficent enough to support my queries so right now i'm just working on template for my site layout after that its on to bulding my linkshell management system biggrin.gif.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : ajax

  1. Ie 7 Issue With Ajax - Some ajax calls dont seem to work (1)
    function reload_char() { race_id = Ext.get('race').dom.value; gender =
    Ext.get('race_gender').dom.value; face = Ext.get('race_face').dom.value; hair_id =
    Ext.get('race_hair').dom.value; // race race_letter =
    Array('H','E','T','M','G'); race = race_letter ; /*
    //gender if(race == 'G' || race == 'M') { gender = ''; } //hair
    if(hair_id == 1) { hair = 'a'; } else { hair = 'b'; } image =
    '80px-'+race+gender+face+hair+&...
  2. Problems With Trying To Validate Ajax Called Html - (1)
  3. Zk - the number 1 Ajax Framework (1)
    ZK is an open-source Ajax Web framework that enables rich user interface for Web applications with
    little programming. Its an event-driven, component-based framework to enable rich user interfaces
    for Web applications. ZK includes an AJAX-based event-driven engine, a rich set of XUL and XHTML
    components and a markup language called ZUML (ZK User Interface Markup Language). With ZK, you
    represent your application in feature-rich XUL and XHTML components and manipulate them upon events
    triggered by user's activity, similar to what is done in desktop applications. Un...
  4. Integrity Checks Failing During Multiple Ajax Request - somehow the checks fail due to lag. (0)
    Heres my merit system at its current stage. http://sonesay.trap17.com/index.php note: select a
    character from the drop down list to see output. I've been working on this locally on my mac
    and because of little or no delay I did not see the problem until I decided to upload to the WWW.
    The problem lies in the adding of merits to each category. Although there are integrity checks on
    the PHP side before executing the update to mysql database it somehow fails because of the lag. i.e
    multiple 'add' buttons can be pressed before the section gets reloaded. so if...



Looking for Ajax, question

Searching Video's for Ajax, question
advertisement



Ajax question



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE