<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : AJAX parts in plugs</title>
		<link>https://www.cotonti.com</link>
		<description>Останні повідомлення в темі</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Sat, 11 Apr 2026 12:04:14 -0000</pubDate>

		<item>
			<title>GHengeveld</title>
			<description><![CDATA[Please note that I've just pushed an update to plug.main.php. My last change required you to send $r through POST. Since that is not backwards compatible I've updated it.<br />
<br />
See <a href="http://trac.cotonti.com/changeset/1220">changeset 1220</a>]]></description>
			<pubDate>Нд, 02 Травень 2010 17:27:43 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24419]]></link>
		</item>
		<item>
			<title>urlkiller</title>
			<description><![CDATA[ok maybe so <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" /><br />
<br />
i got now the following problem when inserting html markup in my xml document it dont get parsed correctly.<br />
<br />
seems like the .text() from juery is filtering out the whole markup like &lt;h1&gt; and such...<br />
<br />
any ideas why it is breaking there?<br />
<br />
<strong>Added 11 minutes later:</strong><br />
<br />
got it already was the cdata thing i was missing for the markup problem:<br />
<pre class="code">&lt;!&#091;CDATA&#091;&quot;.$msgrow&#091;'message'&#093;.&quot;&#093;&#093;&gt;</pre>
<div class="highlight"><pre class="php">
$msgrow&#091;'message'&#093; = sed_parse($msgrow&#091;'message'&#093;);
$msgrow&#091;'date'&#093; = date('d.m.Y H:i:s',$msgrow&#091;'date'&#093;);
$msgrow&#091;'username'&#093; = $msgrow&#091;'username'&#093;;
		
$sendToOut .= &quot;\t&lt;message&gt;\n&quot;;
$sendToOut .= &quot;\t\t&lt;username&gt;&quot;.$msgrow&#091;'username'&#093;.&quot;&lt;/username&gt;\n&quot;;
$sendToOut .= &quot;\t\t&lt;userid&gt;&quot;.$msgrow&#091;'userid'&#093;.&quot;&lt;/userid&gt;\n&quot;;
$sendToOut .= &quot;\t\t&lt;date&gt;&quot;.$msgrow&#091;'date'&#093;.&quot;&lt;/date&gt;\n&quot;;
$sendToOut .= &quot;\t\t&lt;avatar&gt;&quot;.$msgrow&#091;'avatar'&#093;.&quot;&lt;/avatar&gt;\n&quot;;
$sendToOut .= &quot;\t\t&lt;messagebody&gt;&lt;!&#091;CDATA&#091;&quot;.$msgrow&#091;'message'&#093;.&quot;&#093;&#093;&gt;&lt;/messagebody&gt;\n&quot;;
$sendToOut .= &quot;\t&lt;/message&gt;\n&quot;;
</pre></div>
<br />
<strong>Added 16 minutes later:</strong><br />
<br />
hmm somehow it wont send the data when inserting new data over post.<br />
i alwyays get a 930 back and get redirected ... ;( dont find the problem...<br />
<br />
<strong>Added 3 minutes later:</strong><br />
<br />
ok to conclude this:<br />
<br />
<div class="highlight"><pre class="php">		$t-&gt;assign('MY_JS_FUNC', &quot;$(document).ready(function(){
			timestamp = 0;
			updateMsg();
			$(\&quot;form#myform\&quot;).submit(function(){
				$.post(\&quot;plug.php?r=dashboard\&quot;,{
							message: $(\&quot;#sendmessage\&quot;).val(),
							group_id: \&quot;&quot;.$gid.&quot;\&quot;,
							user_id: \&quot;&quot;.$usr&#091;'id'&#093;.&quot;\&quot;,
							x: \&quot;&quot;.sed_sourcekey().&quot;\&quot;,
							user_name: \&quot;&quot;.$urow&#091;'user_name'&#093;.&quot;\&quot;,
							user_avatar: \&quot;&quot;.$urow&#091;'user_avatar'&#093;.&quot;\&quot;,
							action: \&quot;send\&quot;,
							time: timestamp
						}, function(xml) {
								addMessages(xml);
								$('#sendmessage').val('');
				});
				return false;
			});
		});&quot;);
</pre></div>
<br />
<div class="highlight"><pre class="html">											&lt;form id=&quot;myform&quot;&gt;
										 		&lt;textarea class=&quot;minieditor&quot; name=&quot;sendmessage&quot; id=&quot;sendmessage&quot;&gt;&lt;/textarea&gt;
								 				&lt;input type=&quot;submit&quot; id=&quot;submiter&quot; value=&quot;Absenden&quot; style=&quot;margin-left:3px;padding:5px;font-size:12px;width:437px;&quot;&gt;
								 			&lt;/form&gt;
</pre></div>
<br />
<div class="highlight"><pre class="php">defined('SED_CODE') or die('Wrong URL');
// send header
sed_sendheaders();

$time 					= ($_SERVER&#091;'REQUEST_METHOD'&#093; != 'GET') ? sed_import('time','P','INT') : sed_import('time','G','INT');
$action 				= ($_SERVER&#091;'REQUEST_METHOD'&#093; != 'GET') ? sed_import('action','P','TXT') : sed_import('action','G','TXT');
$user_name 			= sed_import('user_name','P','TXT');
$user_avatar 		= sed_import('user_avatar','P','TXT');
$date_now 			= sed_import('time','P','TXT');
$user_id 				= sed_import('user_id','P','TXT');
$group_id 			= sed_import('group_id','P','TXT');
$message 			  = sed_import('message','P','TXT');

if($action == &quot;send&quot;)
{
	$insert = sed_sql_query(&quot;INSERT INTO whiteBox_wave (`username`,`message`,`date`,`avatar`,`userid`,`groupid`) VALUES ('&quot;.$user_name.&quot;','&quot;.$message.&quot;','&quot;.$date_now.&quot;','&quot;.$user_avatar.&quot;','&quot;.$user_id.&quot;','&quot;.$group_id.&quot;')&quot;);
}

$msg = sed_sql_query(&quot;SELECT * FROM whiteBox_wave WHERE date&gt;'&quot;.$time.&quot;' ORDER BY date ASC &quot;);

if(sed_sql_numrows($msg) == 0) $status_code = 2;
else $status_code = 1;

$sendToOut .= &quot;&lt;?xml version=\&quot;1.0\&quot; ?&gt;\n&quot;;
$sendToOut .= &quot;&lt;response&gt;\n&quot;;
$sendToOut .= &quot;\t&lt;status&gt;&quot;.$status_code.&quot;&lt;/status&gt;\n&quot;;
$sendToOut .= &quot;\t&lt;time&gt;&quot;.mktime().&quot;&lt;/time&gt;\n&quot;;
if($status_code == 1)
{
	while($msgrow = sed_sql_fetcharray($msg))
	{

		$msgrow&#091;'message'&#093; 		= sed_parse($msgrow&#091;'message'&#093;);
		$msgrow&#091;'date'&#093; 			= date('d.m.Y H:i:s',$msgrow&#091;'date'&#093;);
		$msgrow&#091;'username'&#093; 	= sed_build_user($msgrow&#091;'userid'&#093;,$msgrow&#091;'username'&#093;);
		
		$sendToOut .= &quot;\t&lt;message&gt;\n&quot;;
		$sendToOut .= &quot;\t\t&lt;username&gt;&lt;!&#091;CDATA&#091;&quot;.$msgrow&#091;'username'&#093;.&quot;&#093;&#093;&gt;&lt;/username&gt;\n&quot;;
		$sendToOut .= &quot;\t\t&lt;userid&gt;&quot;.$msgrow&#091;'userid'&#093;.&quot;&lt;/userid&gt;\n&quot;;
		$sendToOut .= &quot;\t\t&lt;date&gt;&quot;.$msgrow&#091;'date'&#093;.&quot;&lt;/date&gt;\n&quot;;
		$sendToOut .= &quot;\t\t&lt;avatar&gt;&quot;.$msgrow&#091;'avatar'&#093;.&quot;&lt;/avatar&gt;\n&quot;;
		$sendToOut .= &quot;\t\t&lt;messagebody&gt;&lt;!&#091;CDATA&#091;&quot;.$msgrow&#091;'message'&#093;.&quot;&#093;&#093;&gt;&lt;/messagebody&gt;\n&quot;;
		$sendToOut .= &quot;\t&lt;/message&gt;\n&quot;;
	}
}
$sendToOut .= &quot;&lt;/response&gt;&quot;;


header(&quot;Content-type: text/xml&quot;);
header(&quot;Cache-Control: no-cache&quot;);

echo $sendToOut;

ob_end_flush();
</pre></div><br /><br /><b>Added 45 minutes later:</b><br /><br />its quite wierd. because i did yesterday something and today its not working anymore.<br />
i guess i had smething working and deleted or changed it due to testing the parser thing so i think its only a minor problem with my code here..<br />
<br />
but i think iam too blind today for seeing it..]]></description>
			<pubDate>Сб, 24 Кві 2010 00:36:41 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24294]]></link>
		</item>
		<item>
			<title>Trustmaster</title>
			<description><![CDATA[<blockquote><a href="https://www.cotonti.com/forums.php?m=posts&amp;p=24282#24282">#</a> <strong>urlkiller :</strong>
@trustmaster<br />
<br />
as i understand it the $(&quot;input[name=x]&quot;).val() is deprecated since 1.1.4 or so... it should be: $(&quot;input[@name=x]&quot;).val()<br />
</blockquote>
Vice versa.<br />
<a href="http://api.jquery.com/category/selectors/" rel="nofollow">http://api.jquery.com/category/selectors/</a>]]></description>
			<pubDate>Пт, 23 Кві 2010 14:20:09 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24284]]></link>
		</item>
		<item>
			<title>urlkiller</title>
			<description><![CDATA[yeah thanks for the tipps<br />
<br />
iam using firebug as debugger woirking smooth.<br />
<br />
my problem was the x i was sending it 2 times... ;( one in a hidden input (as default) and one as jquery var. i fixed that now... <br />
<br />
@trustmaster<br />
<br />
as i understand it the $(&quot;input[name=x]&quot;).val() is deprecated since 1.1.4 or so... it should be: $(&quot;input[@name=x]&quot;).val()<br />
<br />
<img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" /><br />
<br />
{PHP.sys.xk} this is really helpful...<br />
<br />
<strong>Added 7 minutes later:</strong><br />
<br />
btw i solved it more like the tut was:<br />
but i did the changes to plug.php and the other file and i still get kicked onto the error page in the background (i see the updates after my POST request i get message.php?msg=950 ! BUT get not redirected and stay on the form part of my testsite). seems like some sort of wierd problem...<br />
<div class="highlight"><pre class="php"><pre class="code">
		$t-&gt;assign('MY_JS_FUNC', &quot;$(document).ready(function(){
			timestamp = 0;
			updateMsg();
			$(\&quot;form#myform\&quot;).submit(function(){
				$.post(\&quot;plug.php?r=dashboard\&quot;,{
							message: $(\&quot;#sendmessage\&quot;).val(),
							group_id: $(\&quot;#group_id\&quot;).val(),
							user_id: $(\&quot;#user_id\&quot;).val(),
							x: \&quot;&quot;.sed_sourcekey().&quot;\&quot;,
							user_name: $(\&quot;#user_name\&quot;).val(),
							user_avatar: $(\&quot;#user_avatar\&quot;).val(),
							action: \&quot;send\&quot;,
							time: timestamp
						}, function(xml) {
								addMessages(xml);
								$('#sendmessage').val('');
				});
				return false;
			});
		});&quot;);
</pre></pre></div>
<br />
<strong>Added 41 seconds later:</strong><br />
<br />
above the highlighter bar seems broken when mixing code and the highlight tag <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/wink.gif" alt=";)" />]]></description>
			<pubDate>Пт, 23 Кві 2010 10:58:16 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24282]]></link>
		</item>
		<item>
			<title>GHengeveld</title>
			<description><![CDATA[I noticed that it's not possible to do a POST request to plug.php?r=abc because that will send the $r along with the POST vars, not GET.<br />
<br />
I've fixed this in <a href="http://trac.cotonti.com/changeset/1213">changeset 1213</a>.<br />
With these changes you can make POST request using the ajax hook.<br />
<br />
Note that for POST, sending the sourcekey along with the request is required. You can easily put the key in your JS with the {PHP.sys.xk} tag (in tpl files), so you'd get something like this:<br />
<br />
<div class="highlight"><pre class="js">$.post('plug.php?r=abc&amp;x={PHP.sys.xk}', 
{ &quot;varname&quot;: &quot;value&quot; }, 
function(){ 
// do whatever 
});</pre></div>
<br />
<strong>Added 5 minutes later:</strong><br />
<br />
Also I really recommend testing your jQuery POST requests with <a href="https://addons.mozilla.org/nl/firefox/addon/5946" rel="nofollow">RESTTest</a>. It's easy to check the server's response to your POST request that way. (don't forget the sourcekey)]]></description>
			<pubDate>Пт, 23 Кві 2010 05:18:22 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24279]]></link>
		</item>
		<item>
			<title>Trustmaster</title>
			<description><![CDATA[Well, #x is not a correct selector for that element, to get an input by name better use<br />
<div class="highlight"><pre class="js">$(&quot;input&#091;name=x&#093;&quot;).val()</pre></div>]]></description>
			<pubDate>Thu, 22 Кві 2010 16:54:48 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24276]]></link>
		</item>
		<item>
			<title>ez</title>
			<description><![CDATA[A browser freeze probably means that you are sending your data synch. and not a-synch.<br />
So the browser will wait for an answer (explaining the freeze up).<br />
<br />
Maybe your xml anser never comes back? (so a timeout will occur)<br />
<br />
What is x?<br />
Is x also located as a field within your form or maybe in the cookies? If it is, then you do not have to send it.. maybe this gives a clash..<br />
<br />
TIP:<br />
You really shoud look at the jquery forms plugin.. <br />
That plugin is great and it works easy!<br />
<br />
So a lot off questions and possibilities..]]></description>
			<pubDate>Thu, 22 Кві 2010 02:50:46 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24271]]></link>
		</item>
		<item>
			<title>urlkiller</title>
			<description><![CDATA[Hi,<br />
<br />
i got the following Problem with the Ajax call here:<br />
<div class="highlight"><pre class="js">
		$(document).ready(function(){
			timestamp = 0;
/*			updateMsg();
*/			$(&quot;form#myform&quot;).submit(function(){
				$.post(&quot;plug.php?r=dashboard&quot;,{
							message: $(&quot;#sendmessage&quot;).val(),
							name: $(&quot;#gid&quot;).val(),
							action: &quot;postmsg&quot;,
							x: $(&quot;#x&quot;).val(),
							time: timestamp
						}, function(xml) {
								addMessages(xml);
								$('#sendmessage').val('');
				});
				return false;
			});
		});
</pre></div>
<br />
when submiting the form i got a complete browser freeze. i circled the problem around the security parameter var <strong><span style="text-decoration:underline">X</span></strong> everytime i want to use this i got the complete crash.<br />
<br />
anybody know where the problem is?]]></description>
			<pubDate>Ср, 21 Кві 2010 23:36:50 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=5552&d=0#post24263]]></link>
		</item>
	</channel>
</rss>