elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  que hago mal? (jquery + php)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: que hago mal? (jquery + php)  (Leído 2,781 veces)
colcrt

Desconectado Desconectado

Mensajes: 86


Ver Perfil
que hago mal? (jquery + php)
« en: 5 Enero 2017, 06:26 am »

hola foreros  ;D
vengo a pedir de su gran ayuda, por mas que busco no logro entender que estoy haciendo mal en este pequeño codigo, veran estoy aprendiendo jquery por lo que aun se me dificulta bastante esto si alguno muy amable pudiera decirme donde esta el error le estaria muy agradecido, es un pequeño sistema de puntuación por estrellas

Código:
<div id="star-container" class="votacion">
<i class="fa fa-star star" id="star-1"></i>
<i class="fa fa-star star" id="star-2"></i>
<i class="fa fa-star star" id="star-3"></i>
<i class="fa fa-star star" id="star-4"></i>
<i class="fa fa-star star" id="star-5"></i>
</div>
<div id="result"></div>
<noscript>Necesitas tener habilitado javascript para poder votar</noscript>

Código:
<script>
$(document).ready(function(){
$('.star').on("mouseover",function(){

var star_id = $(this).attr('id');
switch (star_id){
case "star-1":
$("#star-1").addClass('star-checked');
break;
case "star-2":
$("#star-1").addClass('star-checked');
$("#star-2").addClass('star-checked');
break;
case "star-3":
$("#star-1").addClass('star-checked');
$("#star-2").addClass('star-checked');
$("#star-3").addClass('star-checked');
break;
case "star-4":
$("#star-1").addClass('star-checked');
$("#star-2").addClass('star-checked');
$("#star-3").addClass('star-checked');
$("#star-4").addClass('star-checked');
break;
case "star-5":
$("#star-1").addClass('star-checked');
$("#star-2").addClass('star-checked');
$("#star-3").addClass('star-checked');
$("#star-4").addClass('star-checked');
$("#star-5").addClass('star-checked');
break;
}
}).mouseout(function(){

$('.star').removeClass('star-checked');
});

$('.star').click(function(){

var star_index = $(this).attr("id").split("-")[1],
 
star_container = $(this).parent(),
result_div = $("#result");

$.ajax({
url: 'pages/rating_start.php',
type: 'POST',
data: {star:star_index},
beforeSend: function(){
star_container.hide();
result_div.show().html("<h6>Loading...</h6>");
}
})
.done(function(data){
result_div.html(data);
})
.fail(function(data) {
alert( "error" );
 })

});

});
</script>

Código:
<?php
    if(isset($_POST['star'])){
        $star = htmlentities(mysql_real_escape_string($_POST['star']));
        //valid star id array
        $valid_star = array('1','2','3','4','5');
 

        if(!in_array($star, $valid_star)){
            echo '<div class="alert alert-danger" role="alert">Porfavor no haga esto!</div>';
            exit();
        }
 
  
        echo '<div class="alert alert-success" role="alert">Gracias! '.$star.' Estrellas.</div>';
    }
?>

se queda en esta linea ""result_div.show().html("<h6>Loading...</h6>");"" y salta el error



« Última modificación: 5 Enero 2017, 06:28 am por colcrt » En línea

ThinkByYourself

Desconectado Desconectado

Mensajes: 191


Ver Perfil
Re: que hago mal? (jquery + php)
« Respuesta #1 en: 5 Enero 2017, 07:53 am »

Como consejo, puedes usar el console.debug para saber más acerca del error.


En línea

No te voy a engañar.
Todos hemos sido programados para normalizar la psicopatía de las élites económicas y políticas, y para realimentar su patrón de ciega codicia.
colcrt

Desconectado Desconectado

Mensajes: 86


Ver Perfil
Re: que hago mal? (jquery + php)
« Respuesta #2 en: 6 Enero 2017, 02:01 am »

solo veo este error

Código:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
En línea

engel lex
Moderador Global
***
Desconectado Desconectado

Mensajes: 15.514



Ver Perfil
Re: que hago mal? (jquery + php)
« Respuesta #3 en: 6 Enero 2017, 02:54 am »

Es un problema del php, está retornando código 500
En línea

El problema con la sociedad actualmente radica en que todos creen que tienen el derecho de tener una opinión, y que esa opinión sea validada por todos, cuando lo correcto es que todos tengan derecho a una opinión, siempre y cuando esa opinión pueda ser ignorada, cuestionada, e incluso ser sujeta a burla, particularmente cuando no tiene sentido alguno.
colcrt

Desconectado Desconectado

Mensajes: 86


Ver Perfil
Re: que hago mal? (jquery + php)
« Respuesta #4 en: 6 Enero 2017, 03:10 am »

 :huh: es un vps, que debiria ver o que archivo de configuracion editar? nose que hacer pls una ayuda
En línea

eLank0
eLhAcKeR r00Lz


Desconectado Desconectado

Mensajes: 1.062



Ver Perfil WWW
Re: que hago mal? (jquery + php)
« Respuesta #5 en: 6 Enero 2017, 10:42 am »

Error 500, 90% error programacion servidor. Cual es el metodo al q llamas?
En línea

colcrt

Desconectado Desconectado

Mensajes: 86


Ver Perfil
Re: que hago mal? (jquery + php)
« Respuesta #6 en: 6 Enero 2017, 23:12 pm »

hola, aun sigo sin poder solucionar esto  :-\ me puse a ver los log's y me tope con esto que podria ser??

Código:
Stack trace:
#0 {main}
  thrown in /var/www/html/pages/rating_start.php on line 3" while reading response header from upstream, client: xx.xx.xx.xx, server: www.xxxxxx.ga, request: "POST /pages/rating_start.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.xxxxxx.ga", referrer: "https://xxxxxx.ga/"
2017/01/06 00:50:21 [error] 1195#1195: *4076 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function mysql_real_escape_string() in /var/www/html/pages/rating_start.php:3
Stack trace:
#0 {main}
  thrown in /var/www/html/pages/rating_start.php on line 3" while reading response header from upstream, client: xx.xx.xx.xx, server: www.xxxxxx.ga, request: "POST /pages/rating_start.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.xxxxxx.ga", referrer: "https://xxxxxx.ga/"
2017/01/06 00:50:51 [error] 1195#1195: *4076 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function mysql_real_escape_string() in /var/www/html/pages/rating_start.php:3
Stack trace:
#0 {main}
  thrown in /var/www/html/pages/rating_start.php on line 3" while reading response header from upstream, client: xx.xx.xx.xx, server: www.xxxxxx.ga, request: "POST /pages/rating_start.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.xxxxxx.ga", referrer: "https://www.xxxxxx.ga/"
2017/01/06 01:00:16 [error] 1195#1195: *4101 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function mysql_real_escape_string() in /var/www/html/pages/rating_start.php:3
Stack trace:
#0 {main}
  thrown in /var/www/html/pages/rating_start.php on line 3" while reading response header from upstream, client: xx.xx.xx.xx, server: www.xxxxxx.ga, request: "POST /pages/rating_start.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.xxxxxx.ga", referrer: "https://www.xxxxxx.ga/"

y se repite varias veces...

edito ya encontre el error me di cuenta que "mysql_real_escape_string" esta en desuso por lo que daba ese error la cambie a "mysqli_real_escape_string" ahora se ya funciona  ;-) ;-) gracias chicos por su ayuda
« Última modificación: 6 Enero 2017, 23:21 pm por colcrt » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
php + jquery
PHP
Kase 5 6,221 Último mensaje 19 Marzo 2011, 01:47 am
por Graphixx
Problema con jquery
Desarrollo Web
skdna 3 2,688 Último mensaje 8 Noviembre 2010, 17:52 pm
por bizco
[Aporte] JQuery
Desarrollo Web
AFelipeTrujillo 4 4,163 Último mensaje 4 Enero 2011, 14:43 pm
por AFelipeTrujillo
[Ayuda] Usar 2 Jquery al mismo tiempo - Usar 2 veces jquery
Desarrollo Web
Graphixx 5 7,893 Último mensaje 19 Diciembre 2012, 17:17 pm
por #!drvy
php con jquery
PHP
geshiro 0 1,102 Último mensaje 4 Octubre 2015, 23:32 pm
por geshiro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines