0

I have a json like below

[
    {"name":"mynewname", "id" : "t2", "location" : "India"},
    {"name":"mynewname1", "id" : "t21", "location" : "China"},    
]

I have many json data like above..

I need to textbox to Search the above data..

6
  • 1
    did you try anything so far? what do you need filtered exactly? Commented Aug 8, 2012 at 9:55
  • what have you tried? what are you filter criteria? Do you have any code attempt to show us? Commented Aug 8, 2012 at 9:56
  • sorry i dont have that code... its in my home pc Commented Aug 8, 2012 at 9:56
  • You should at least have some idea of what you code does... Commented Aug 8, 2012 at 9:59
  • i just need a textbox to search the data above Commented Aug 8, 2012 at 10:00

1 Answer 1

4

You can try this:

http://jsfiddle.net/geektantra/DsF7J/3/

NOTE: I am using Regular expressions for doing a full-text search through the JSON. This could affect performance when the size of your JSON data increases.

Sign up to request clarification or add additional context in comments.

4 Comments

it's working in the fiddle - could you provide us with more code so that we may help you better?
Using the javascript piece of code which has been given as answer in jsfiddle inside the body part of html is not working.I have used that code inside <script type="text/javascript">.....</script>,but its not working at all.
The javascript code must be put inside <script type="text/javascript">jQuery(function() { ..... });</script>. JS Fiddle takes this from the left hand drop-downs. Check the source code of this page view-source:fiddle.jshell.net/geektantra/DsF7J/3/show for the working code.
I have been going all over the internet for something like this. This answer is perfect! Thank you

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.