English 中文(简体)
我的单体 j
原标题:simple jquery fetch from mysql
  • 时间:2010-04-06 15:22:28
  •  标签:
  • php
  • jquery

我正试图与教育、青年和体育部合作,我写道:

<html>

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
function example_ajax_request() {
  $( #example-placeholder ).html( <p>Loading results ... <img src="ajax-loader.gif"  /></p> );
  $( #example-placeholder ).load("loadres.php");
}
</script>
</head>
<body>
<div id="query">
<select name="show"  id="box" >

 <option value="0">Select A Test</option>
 <option value="All">--All--</option>
 <option value="M1">Model1</option>
    </select>
<input type="button" onclick="example_ajax_request()" value="Click Me!" />
</div>
<div id="example-placeholder">
  <p>Placeholding text</p>
</div></body>
</html>

Basically I want to pass parameters to the loadres.php file. But unable to figure out the exact way to do. Any help is appreciated.

感谢。

最佳回答
$( #example-placeholder ).load("loadres.php?show=" + $( #box option:selected ).val());

这将利用分类从下级清单中获取选定价值,并将它作为直线参数,供你在负荷上使用。 php page.

问题回答

您应使用“ j”方法。 您可以将数据传送给导游,最终会回击。

$.ajax({
  url:  loader.php ,
  data:  somedata ,
  type:  GET ,
  success: function(data){
    $( #example-placeholder ).text(data);
  }
});

这样做将达到极限。 这种方法也提供了更大的灵活性。 你可以有不同的职能,如错误职能和完整的职能。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签