1

I have 3 text input areas, within a single form, with a preformated value, like "blue", "red", "green", and I'm in need of loading these values dynamically from a INI file instead of having them pre-written, without reloading the page, and each time I click a link. I can't have that link submitting a form.

1
  • It sounds a bit like you're trying to use jQuery in place of a server-side language... is that correct? With a server-side language you'd just use it to read the INI file and write out the input values... Commented Apr 17, 2011 at 7:03

1 Answer 1

3

Loading Values Dynamically

  1. Read INI file using PHP/ASP/Ruby/Python etc etc

  2. Output those values to 3 JS variables or an array

  3. Get your jquery to read that variable and populate the input boxes. You can use $('#someid').val(someVal);

Or

You can use AJAX to grab the values after the pages have loaded. Not much point in that though.

Make links not clickable

$('a').click(function(){
   return false; //Link clicked but does nothing
})
Sign up to request clarification or add additional context in comments.

8 Comments

@JohnP ::: You can simply use preventDefault(); function instead of return false;.
PS: No this is not what I need, I think I found the pipeline, please write me a snippet on how to pass a link "rel" value trough ajax onto a php file that gets the "rel" value as a POST var, performs calculations with it and then returns the output of that php file into another form? The ideia is to: 1. click a link, get its "rel" value. 2. Send that value into a php file. 3. Return the contents of that php file back (they will be 3 text input fields) 4. Paste them onto a form on the page
@Joricam Since you're new here you might not know that asking for a complete solution without any good faith effort on your part is frowned upon. Please try it out yourself and ask a new question if you run into problem. @Jack return false also stops event bubbling
Ok Thanks, I'm trying it right now after some hours of sleep, I need the link to retun true, thats not the problem. Best Regards
<html> <head> <script src="ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> <script> $(function (){ $(body).html('<p>Balls of steel</p>'); }); </script> </head> <body> </body> </html> I'm not sure about the body selector, but I tried with proper selected divs and the .html(...) is not working, does nothing, why?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.