Page 1 of 1

Use ajax correctly in joomla.

Posted: Mon Sep 29, 2008 5:24 pm
by conan1212
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?

Re: Use ajax correctly in joomla.

Posted: Sat Dec 20, 2008 2:57 am
by D-Maz
Did you ever get this resolved? I ran into the same situation...

Re: Use ajax correctly in joomla.

Posted: Sat Dec 20, 2008 6:44 am
by amol.meshram
Use index3.php instead of index2.php in the url

Re: Use ajax correctly in joomla.

Posted: Mon Dec 29, 2008 6:21 pm
by kishoremaj
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

Re: Use ajax correctly in joomla.

Posted: Thu Aug 23, 2012 9:28 am
by sawais
Did you ever get this resolved? I ran into the same situation... :'( :'( :'(