473,804 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with jQuery's $.ajax function

1 New Member
Hi,

I'm a little stuck with Ajax (really am not getting it at the moment!)

I'm trying to write into a div when something is typed into a box...

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5.         <title>Untitled Document</title>
  6.          <script type="text/javascript" src="jquery.js"></script>
  7.                  <script type="text/javascript">
  8.             $.ajax({ 
  9.             type: "POST",
  10.             url:  "autocomplete.php",
  11.             data: "typing=1",
  12.             success: function t() {
  13.             //stuck on what to put in here....
  14.                                                //insert into div values from (autocomplete.php)    
  15.             }
  16.  
  17.             });
  18.  
  19.         </script>
  20.  
  21.     </head>
  22.     <body>
  23.     Answer: <div id="contentArea"></div>
  24.  
  25.     <input type="text" name="query" onkeyup="t()"/>
  26.     </body>
  27. </html>
  28.  
  29.  
I'm stuck on how to load what the php returns into a div...? any ideas?

Thanks
Jun 20 '07 #1
1 1863
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

I'm not familiar with jQuery's $ajax function. What does it return? In an normal Ajax function with XMLHttpRequest, you get responseXML and responseText. If you get the same here, you could try:
Expand|Select|Wrap|Line Numbers
  1. =javascript]document.getElementById('contentArea').value=this.responseText;
If that doesn't work, I'd have to look at the jquery source file.
Jun 20 '07 #2

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

Similar topics

3
2757
by: geshan | last post by:
Hello all, I'm having trouble populating a select box as per the selection of above select box.Its like level 2 select box depends on the value of level 1 box. Both the boxes values come from a mysql database. I tried to use AJAX, Jquery and JSON but I can send only string values I want to send the id of the records (int) which are numbers please help. GEshan
3
3721
by: Don Quijote de Nicaragua | last post by:
Hi, is there any way to insert a registration in SQL Server using Jquery en ASP.NET.
1
49890
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to get anything to happen. Below is the code. Thanks in advance. jQuery: jQuery(document).ready(function() { jQuery("a").click(function() { jQuery("#dialog").dialog({ modal: true,
3
2410
by: NetWave | last post by:
Hi, For my next project I'm going to need Ajax, so I'm in about to read some books on ASP.NET Ajax. While reading Rick Strahl's blog I stumbled upon jQuery. I've been to the website and seen some examples, and it sure looks promising. However, I'm not sure how it relates to ASP.NET Ajax. Do they complement each other? Or are they concurrent products?
26
3156
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit of momentum, can it be considered a reasonable choice for those who want to use a full-featured, well supported library? <URL: http://jquery.com/blog/2008/09/28/jquery-microsoft-nokia/ >
53
8429
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script language="javascript" type="text/javascript">
3
1827
pradeepjain
by: pradeepjain | last post by:
hii guys, I am newbie to jquery and ajax . I am stuck to know when to use jquery and ajax . which is better to use and fast . can anyone plz explain .
5
4962
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html Here is some jquery js that I think...
11
1681
pradeepjain
by: pradeepjain | last post by:
i am building a select based on the values in a text box . like $("#pincode").change(function(){ $.post("doctor_search.php",{ pincode:$("#pincode").val()} ,function(data){ $("#suggestions").html(data); }); }); when ever a error occurs when the form is submitted the select does not work as ajax is a change function . how to say to jquery tht do it if the value in the text box is not null also i.e trigger a event ??
0
9711
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
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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
7633
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
6862
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
5529
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...
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.