Response title
This is preview!
- (function($) {
- $.fn.fond = function (newClass) {
- return this.each(function() {
- $(this).mouseover(function(){
- $(this).addClass(newClass);
- });
- $(this).mouseout(function(){
- $(this).removeClass(newClass);
- });
- });
- }})(jQuery);
- $(function () {
- $('.article').fond(bgHover);
- });
- <div class="article"> //the content here is an image
- <div class="title"> //the content here is the title of the image
- </div>
- </div>
and the result should be a color image in the background...Do you see anything?Thanks f!
- <div id="blocus">
- <?php
- while ($donnees = $req ->fetch()) {
- $get_id = $donnees['id'];
- echo '<a href="articles.php?id= '.$get_id.' "> '.$get_nom.'</a>' ;
- echo '<img src= '.$get_image.' /><br/>' ;
- ?>
then i try to catch the result of the POST method with Ajax, but i need to re-write the "while" function because i looked for a new kind of content in my database, and now i would like to post it on the page. So i wrote here the data result, but can you please tell me how i can tell jquery "for each line you will receive, write every time the <a> link followed by data.id, and data.nom etc... ?
here is the code to send the request and catch the return data :
- $.post (url, { action:filter, filtre:id }, function (data) {
- if (data.result=="ok"){
- $(".fiche").empty()
- .append('<a href="articles.php?id='data.id' > 'data.nom'</a>'
- <img src= 'data.image' /><br/>' data.nom </div>');
- }, "json");
Thanks for your help !
- <div id="blocus">
- <?php while ($donnees = $req ->fetch()) {
- $get_id = $donnees['id'];
- echo '<a href="articles.php?id= '.$get_id.' "> '.$get_nom.'</a>' ;
- echo '<img src= '.$get_image.' /><br/>' ;
- ?>
then i try to catch the result of the POST method with Ajax, but i need to re-write the "while" function because i looked for a new kind of content in my database, and now i would like to post it on the page. So i wrote here the data result, but can you please tell me how i can tell jquery "for each line you will receive, write every time the <a> link followed by data.id, and data.nom etc... ?
here is the code to send the request and catch the return data :
- $.post (url, { action:filter, filtre:id }, function (data) {
- if (data.result=="ok"){
- $(".fiche").empty()
- .append('<a href="articles.php?id='data.id' > 'data.nom'</a>'<img src= 'data.image' /><br/>' data.nom </div>'); },
- "json");
Thanks for your help !
echo '<div id="numbers">'; for ($i = 1 ; $i <= $nombreDePages ; $i++) { echo '<a href="index.php?page=' . $i . '" title="'.$i.'">' . $i . '</a>'; } echo '</div>
$(function () { var url = "pageTest.php", numbers = $('#numbers').find('a'); numbers.each (function () { var t = $(this), id = t.attr("title"); t.click (function() { $.post (url, { action:"page", infos:id }, function (data) { alert(data.nom); }, "json"); }); }); });
<?php require("connect.php"); $d =array(); if ( $_POST['action']=="page") { $d['verif']="ok"; $d['test']="allo? oui cest bon ca marche ! "; print_r($d); } echo json_encode($d); ?>
© 2013 jQuery Foundation
Sponsored by and others.