Note that there are some explanatory texts on larger screens.

plurals
  1. PO2 Dependent jQuery-UI Sliders
    primarykey
    data
    text
    <p>I'm trying to develop a loan simulator using 2 jQuery-UI Sliders.</p> <p>The 1st slider (prazo) represents the length of the loan in months The 2nd slider (mensalidade) represents how much you'll be paying each month during the loan.</p> <p>The sliders are of course dependent of the amount required.</p> <p>I have all the data in a MySQL database.</p> <p>The first slider works OK. For an amount of 1000 there are 2 lengths: 48 and 72 months, there for 2 different loan amounts 48 months - 301.88 72 months - 188.88</p> <p>First problem: the value of mensalidade (2nd slider) loses it's decimal part - becomes 301 and 188 instead of 300.88 and 187.88</p> <p>Second problem: If we start sliding the first slider, the second one freezes and vice-versa.</p> <p>Third problem: Is there a better way to filter my json? Or should I alter the json structure? How? My json file: - beta.classificados.mpl.pt/clientes/cofidis/filter.php?filtro=prazo&amp;prazo=48&amp;montante=1000 (for slider 1)</p> <ul> <li>beta.classificados.mpl.pt/clientes/cofidis/filter.php?filtro=mensalidade&amp;mensalidade=187.88%E2%82%AC&amp;montante=1000 (for slider 2)</li> </ul> <p>What I'm doing is:</p> <pre><code>$.each(data, function (key, value) { console.log(key, value); if (key &gt; 0) { $("#partner_id").val(value.partner_id); $("#partner_desc").val(value.partner_desc); $("#oferta_id").val(value.oferta_id); $("#seguro_id").val(value.seguro_id); $("#seguro").val(value.seguro); $("#mtic").val(value.mtic); $("#tan").val(value.tan); $("#taeg").val(value.taeg); } }); </code></pre> <p>Fourth problem: The 1st slider is fairly simple - I know the min and max and step value, because it's more or less static and the calls to the json file are less because of the step being 6. But for the 2nd slider, I had to place the step at 1 because it could pass a needed value. Thus, it calls the json file at each step of the slider. I think this will cause slider update to take very long.</p> <p>I've set up a fiddle here: <a href="http://jsfiddle.net/mjpramos/3m7wy/7/" rel="nofollow">http://jsfiddle.net/mjpramos/3m7wy/7/</a> and you can check it at <a href="http://beta.classificados.mpl.pt/clientes/cofidis/simulador.php" rel="nofollow">http://beta.classificados.mpl.pt/clientes/cofidis/simulador.php</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload