Jump to content
php.lv forumi

javascript reload


false

Recommended Posts

index.php fails

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>title</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="/js.js"></script>
</head>
<body>
<div class="rand">
<a href="javascript:;" onclick="load_someone_said(); return false;"><img src="efresh.gif" style="border: 0pt none ;"></a>
<?php include("rand.php"); ?></div>
</head>
</html>

 

rand.php

<?php
rand(4,412); 
?>

js.js fails

function load_monitor() {
$("#rand").html('<img style="background-position: center;" src="http://heal.lv/style/web_images/spinner.gif">');
$("#rand").load("rand.php");
}

Problēma ir tāda kā viņš negrib neko refrešot?

Edited by false
Link to comment
Share on other sites

1) ja tu nodefinē funkciju load_monitor(), tad arī izsauc to, nevis load_someone_said()

2) ja tu gribi kko saņemt no rand.php, tad tur ir jābūt echo rand(4,412); nevis vnk rand(4,412);

3) ja tu gribi kko ierakstīt iekš taga ar id "rand", tad tam vajag atribūtu id="rand", nevis class="rand"

4) un ņemot vērā visu iepriekšējo, ļoti iespējams, ka jquery bibliotēka arī nemaz nav inkludota. publiskā piemērā varēji ielikt kaut vai

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

izlabojot to, tā jau savādāk viss strādā

 

nekas, kad paaugsies, tad jau arī kļūdas paliks "gudrākas" ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...