Hi all,
I'm new on elg and I'm teaching to develope a plugin now, with help of the book "Elgg 1.8 socal networking" (http://www.amazon.it/dp/1849511306/ref=asc_df_184951130628143236/?tag=googshopit-21&creative=23390&creativeASIN=1849511306&linkCode=df0)
I have basically rewritten the first example of the plugin libo that obviously works. Then I changed the page displayed by the plugin by entering an input form with fields of research as below:
$body = elgg_view_layout('one_sidebar', $vars);
$body = "<body>
<script type=\"text/javascript\" src=\"jquery-2.1.4.min.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function()
{
$(\"#input_form\").submit(function(){
var codAic = $(\"#CodiceAic\").attr('value');
var principioAttivo = $(\"#PrincipioAttivo\").attr('value');
$.post(\"result.php\", {codAic:codAic, principioAttivo:principioAttivo }, function(data){
$(\"div#result\").html(data);
});
return false;
});
</script>
<br>
<form id=\"formMedicine\" name=\"Medicine\" method=\"post\" action=\"?\">
<p>
Codice Aic: <input name=\"CodiceAic\" type=\"text\" id=\"CodiceAic\" />
Principio Attivo: <input type=\"text\" name=\"PrincipioAttivo\" id=\"PrincipioAttivo\" />
</p>
<p>
Denominazione: <input type=\"text\" name=\"Denminazione\" id=\"Denminazione\" />
Ditta: <input type=\"text\" name=\"Ditta\" id=\"Ditta\" />
</p>
<p>
<input type=\"submit\" value=\"cerca\">
</p>
</form>
<p> </p>
<div id=\"result\"> </div>";
echo elgg_view_page($title, $body);
in the file result.php there is only this:
<?php
echo "Hai inserito i seguenti dati: Codice Aic‐><strong>$_POST[codAic]</strong> e Principio Attivo‐><strong>$_POST[principioAttivo]</strong>. Hai eseguito una chiamata ascinrona!";
?>
I also tried this way:
<?php
echo " $body .= \"Hai inserito i seguenti dati: Codice Aic‐><strong>$_POST[codAic]</strong> e Principio Attivo‐><strong>$_POST[principioAttivo]</strong>. Hai eseguito una chiamata ascinrona!\";" ;
?>
The result is evere a refresh of the div but I see nothing.
Can anyone help me?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Pietro Ricciardi@PRicciardi
Pietro Ricciardi - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Pietro Ricciardi@PRicciardi
Pietro Ricciardi - 0 likes
- Pietro Ricciardi@PRicciardi
Pietro Ricciardi - 0 likes
- Pietro Ricciardi@PRicciardi
Pietro Ricciardi - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Pietro Ricciardi@PRicciardi
Pietro Ricciardi - 0 likes
You must log in to post replies.Sorry, just a new try, removing the line below from first file:
<script type=\"text/javascript\" src=\"jquery-2.1.4.min.js\"></script>
Some rusults :(
Which Elgg version are you using?
I have installed the rel, 1.11 and I have updated the installation with administrative function yesterday.. than i think that now the site uses the rel 1.12
Verified: Release - 1.11.0, Version - 2015031300
nobody can help me ?
First of all, you should add the javascript as an AMD module: http://learn.elgg.org/en/1.12/guides/javascript.html
jQuery will be loaded asynchronously, so it isn't necessarily available when your script is called.
secondly, you're binding on
When your form has the id of
oh, yes, yesterday I have seen and corrected the error without difference. I'll see the url you have writen, thanks so mutch...