duankanyi6539 2011-03-05 23:03
浏览 140
已采纳

jqueryUI Slider:设置DB范围内的最小值和最大值

I have a jQueryUI slider on my website that deals with price range.

I have a products table in mysql that has various entries.

I am using the slider to filter the results, but I need to set the minimum and maximum prices from the records in my database.

Should I just generate (with php) hidden fields in my html that contain the minimum and maximum and then use jQuery to obtain them? Or is there a better way of achieving this, maybe using AJAX?

Thanks

  • 写回答

3条回答 默认 最新

  • duanpaxin3531 2011-03-05 23:13
    关注

    Either of the ways you have described would get the job done, I would probably go for the hidden fields.

    Another option might be to have your php put the values into your javascript file directly.

    you just need to change the header in your php file to get the output to be read as javascript by the browser.

    this would do it.

    Header("content-type: application/x-javascript");
    

    you can the set the values right in the javascript via your php (as in any other php file).

    Include it on your page as you would any other javascript file and job done, its simple and dynamic. :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料