【问题标题】:Passing the PHP value to a thrid party script in jQuery将 PHP 值传递给 jQuery 中的第三方脚本
【发布时间】:2011-04-18 08:45:18
【问题描述】:

how is this jquery app validating the username? (3rd party script)

我正在使用与上述问题中提到的相同的第三方脚本进行表单验证 .现在我们在第三方脚本中有一个名为 jquery.validationEngine-en.js 的文件。所以我的 html 中有一个名为

的字段
<input type="text"  id ="test1"  value ="" class ="ajax[optional,ajaxcode]">

在jquery.validationEngine-en.js中我们已经这样定义了

   "ajaxcode":{  
        "file":"get_custcode.php?citycode=",
        "alertText":"code is already taken",
        "alertTextOk":"", 
        "alertTextLoad":"* Checking..."
   },

所以我的问题是我如何通过一些动态值 (PHP) 传递城市代码(参数),这在服务器端脚本 (PHP) 中是非常强制性的,以确保该城市不存在 custcode。但是我无法通过城市代码。这是我尝试过的各种事情 用于传递价值

 "file":"get_custcode.php?citycode="+<? echo $_REQUEST['citycde']?>,

   "file":"get_custcode.php?citycode=<? echo $_REQUEST['citycde']?>",

【问题讨论】:

    标签: jquery jquery-plugins jquery-selectors


    【解决方案1】:

    如何将城市的值放在一个隐藏的表单中,让 jQuery 从中获取值进行验证:

    HTML

    <input type="hidde" id="cityCode" value='<? echo $_REQUEST['citycde']?>' />
    

    js脚本

    "file" : "get_custcode.php?citycode="+$("#cityCode").val()
    

    【讨论】:

      猜你喜欢
      • 2012-08-19
      • 1970-01-01
      • 2020-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-23
      相关资源
      最近更新 更多