Baran Topal

Categories


baran
Author

baran

Jquery click issue

I was always surprised with this arcane behavior of Jquery: <div class="wrapper">... $("div.wrapper").click(function() { alert("1123"); }); and above fails so psychological acceptance is not correct in this occasion. Correct one is below: jQuery(document).on("click", ".wrapper", function() { alert("1123"); });

baranbaran

undefined or null state check with JS

This might be handy or maybe an overkill for checking undefined or null state with JS. In practice, i don’t really do such checks in frontend but i sometimes do check, especially for debugging purposes. // Test for conditions individually if (typeof myvar == 'undefined') { alert('myvar is not defined'); } else if (myvar == null) { [...]

baranbaran

ajax-JSON-servlet

Long time ago, I needed to post some JSON data data to my servlet and here you go: <script src="http://code.jquery.com/jquery-latest.js"></script><script> $(document).ready(function() { $("#myformid").on('submit', function() { $.ajax({ dataType: "json", url: "/servlets/baran.JSONExample", data: [...]

baranbaran

some silly JSON parser in Java

Long ago again, I implemented this JSON parser and btw, the following will fail if you are not using proper libraries, commons-collections-3.2.1 and commons-lang 2.6 import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Set; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import [...]

baranbaran