jQuery

Gestart doorMaartenl10 reacties96 weergaven

11 berichten · pagina 1 van 1

Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik heb nu dit :

$.ajax({
    type: "POST",
    url: "pagina.php",
    data: "data="+response,      
    cache: false
  });


[COLOR= #0000BB]<?[/COLOR]
  [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]admin/include/config.php[/COLOR][COLOR= #007700]);[/COLOR]
  [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]])){[/COLOR]
    [COLOR= #0000BB]$adfb[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM ad_kliks WHERE titel="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]hoi[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET cash=cash+"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$adfb[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beloning[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR]id[COLOR= #007700]().[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
}[/COLOR]
  ?>


Maar hij voert die $_POST[data] niet uit sadleyHoe weet ik dat ?
Als ik gewoon +1 doe dan werkt het wel biggrinDus hoe los ik dit op ?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Gebruik eens goede foutafhandeling, en bekijk je result eens met Firebug
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Geeft je console / Firebug nog een javascript melding?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waar defineer je response?
0
Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Milan schreef:
Waar defineer je response?
Via iets maar weet niet wat precies, maar het wordt wel meegegeven, want ik kan het wel laten weergeven.
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En als je de naam data eens in data2 veranderd? Misschien ziet jQuery het als een functie.
0
Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Milan schreef:
En als je de naam data eens in data2 veranderd? Misschien ziet jQuery het als een functie.
Zal het vanavond eens testen.
0
Berichten
788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maartenl schreef:
Eerdere citaten tonen
Milan schreef:
En als je de naam data eens in data2 veranderd? Misschien ziet jQuery het als een functie.
Zal het vanavond eens testen.
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]admin/include/config.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$adfb[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM ad_kliks WHERE titel="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET cash = cash + "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$adfb[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beloning[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
}[/COLOR]
?>


Probeer dit eens want ik snap niet waarom je WHERE id=".id().""); enzo hebt gedaan.
0
Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Dat heet functies.
Waar zet je iets in de response variable?

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]admin/include/config.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]]) && ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]]))
{[/COLOR]
    [COLOR= #0000BB]$adfb[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM ad_kliks WHERE titel="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]data[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" LIMIT 1"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR]json_encode[COLOR= #007700]([/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]succes[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]error[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]Quiery 1 mislukte. Error: [/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]())));[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET cash=cash+"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$adfb[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beloning[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" WHERE id="[/COLOR][COLOR= #007700].[/COLOR]id[COLOR= #007700]().[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR]json_encode[COLOR= #007700]([/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]succes[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]error[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]Query 2 mislukte. Error: [/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]())));;[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR]json_encode[COLOR= #007700]([/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]succes[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])));
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR]json_encode[COLOR= #007700]([/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]succes[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]error[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]Post "Data" bestond niet.[/COLOR][COLOR= #007700])));
}[/COLOR]
?>


$.ajax({
    type: "POST",
    url: "pagina.php",
    data: "data="+response,      
    cache: false,
    function (data) {
        if(data.succes == 1)
        {
            alert("Succesvol uitgevoerd.");
        }
        else if(data.succes == 0)
        {
            alert(data.error);
        }
        else
        {
            alert("Er is iets foutgegaan maar we kunnen niet achterhalen wat.");
        }
    },
    JSON
  });
0
Maartenl

Lid · Topicstarter

Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zalfjes straks een testen.
@MrDylan : inderdaad een functie wink
0
Berichten
788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maartenl schreef:
Zalfjes straks een testen.
@MrDylan : inderdaad een functie wink
Oh ik werk hier nooit meer maar ty voor de uitleg smile
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren