Jquery with Ajax Interview questions for freshers as well 1 to 3 year experienced on advance and basic Jquery with examples that cover the essentials of Jquery objects means all type of Jquery questions covered under this page and also a form is given at the end of this page for those user who want more Interview questions and answer on Database just need to fill the form and send us we will send all the answers to them and it for both freshers and experienced condidate
Questions : 1 | What is jQuery ? |
Answers : 1 | It's very simple but most valuable Question on jQuery means jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, animating, event handling, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. Jquery is build library for javascript no need to write your own functions or script jquery all ready done for you |
Questions : 2 | How you will use Jquery means requirement needed for using jquery |
Answers : 2 |
Nothing more need to do just olny download jquery library(.js file) from any of the jquery site Download jquery and just linked with your html pages like all other javascript file like below :< script src="jquery.js" language="javascript" type="text/javascript"> script> |
Questions : 3 | what the use of $ symbol in Jquery |
Answers : 3 |
$ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery |
Questions : 4 | How do you select an item using css class or ID and get the value by use of jquery |
Answers : 4 |
If an element of html like < div> , < p> or any tag have ID MyId and class used MyClass then we select the element by below jquery code $('#MyId') for ID and for classs $('.MyClass') and for value var myValue = $('#MyId').val(); // get the value in var Myvalue by id Or for set the value in selected item $('#MyId').val("print me"); // set the value of a form input |
Questions : 5 | How to get the server response from an AJAX request using Jquery? |
Answers : 5 |
When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received. Below an example of making an AJAX call and alerting the response (or error): $.ajax({ url: 'pcdsEmpRecords.php', success: function(response) { alert(response); }, error: function(xhr) { alert('Error! Status = ' + xhr.status); } }); |
Questions : 6 | How do you update ajax response with id " resilts" |
Answers : 6 |
By using below code we can update div content where id 'results' with ajax response function updateStatus() { $.ajax({ url: 'pcdsEmpRecords.php', success: function(response) { // update div id Results $('#results').html(response); } }); } |
Questions : 7 | How do You disable or enable a form element? |
Answers : 7 |
There are two ways to disable or enable form elements. Set the 'disabled' attribute to true or false: // Disable #pcds $('#pcds').attr('disabled', true); // Enable #pcds $('#pcds').attr('disabled', false); Add or remove the 'disabled' attribute: // Disable #pcds $("#pcds").attr('disabled', 'disabled'); // Enable #x $("#pcds").removeAttr('disabled'); |
Questions : 8 | How do you check or uncheck a checkbox input or radio button? |
Answers : 8 |
There are two ways to check or uncheck a checkbox or radio button. Set the 'checked' attribute to true or false. // Check #pcds $('#pcds').attr('checked', true); // Uncheck #pcds $('#pcds').attr('checked', false); Add or remove the 'checked' attribute: // Check #pcds $("#pcds").attr('checked', 'checked'); // Uncheck #pcds $("#pcds").removeAttr('checked'); |
Questions : 9 | How do you get the text value of a selected option? |
Answers : 9 |
Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is easy: $("#pcdsselect").val(); // => 1 The second is the text value of the select. For example, using the following select box: <select id="pcdsselect"> <option value="1">Mr</option> <option value="2">Mrs</option> <option value="3">Ms</option> <option value="4">Dr</option> <option value="5">Prof</option> </select> If you wanted to get the string "Mr" if the first option was selected (instead of just "1"), you would do that in the following way: $("#mpcdsselect option:selected").text(); // => "Mr" |