Use ajax correctly in joomla.

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
conan1212
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Wed Sep 17, 2008 3:30 pm
Location: Vietnam
Contact:

Use ajax correctly in joomla.

Post by conan1212 » Mon Sep 29, 2008 5:24 pm

When you call a request via ajax, returned data will have more html code than needed data.

when I try to call ajax via url index2.php?option=com_hello data return still have doctype and more html tag

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
	  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="robots" content="index, follow" />
  <meta name="keywords" content="Ketnoivn, Ketnoivn" />
  <meta name="description" content="Joomla! - the dynamic portal engine and content management system" />
  <meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />
  <title>Ketnoivn</title>
  <link href="/joomla/templates/ja_purity/favicon.ico" rel="shortcut icon" type="image/x-icon" />

	<link rel="stylesheet" href="/joomla/templates/ja_purity/css/template.css" type="text/css" />

</head>
<body class="contentpane">
	<!-- ajax data here  -->

</body>
</html>
while I only want this data : <!-- ajax data here -->
Currently I use exit to stop execute script, But It is not good solution for this problem.
Any body can tell me how to disable render layout and only return ajax data?
[CMS BASE ON Zend Frameowrk]http://zfvn.co.cc
[Conan1212 Blog:]http://phplaw.[URL banned].com

Conan1212 is me a ditector in the world of php.

D-Maz
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Dec 20, 2008 2:53 am

Re: Use ajax correctly in joomla.

Post by D-Maz » Sat Dec 20, 2008 2:57 am

Did you ever get this resolved? I ran into the same situation...

User avatar
amol.meshram
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Dec 20, 2007 5:23 am
Location: Pune, India
Contact:

Re: Use ajax correctly in joomla.

Post by amol.meshram » Sat Dec 20, 2008 6:44 am

Use index3.php instead of index2.php in the url
Meshram Amol
Web Application Developer
FreeLancer
Pune 411 011, India.
Mobile: +91 9860202692
http://www.jlancers.com
http://www.aarogya.com

kishoremaj
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Wed Jan 02, 2008 4:08 pm
Location: india
Contact:

Re: Use ajax correctly in joomla.

Post by kishoremaj » Mon Dec 29, 2008 6:21 pm

you need to pass parameter in url to tell the joomla that you only need raw data not html. it can be done with ease below.

for j1.5 .x pass &format=raw
for j1.0.x pass &no_html=1
in your url

Thanks
kishore

sawais
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Aug 13, 2012 6:11 am
Location: Jaipur

Re: Use ajax correctly in joomla.

Post by sawais » Thu Aug 23, 2012 9:28 am

Did you ever get this resolved? I ran into the same situation... :'( :'( :'(


Locked

Return to “Joomla! 1.5 Coding”