Tampilkan postingan dengan label javascript. Tampilkan semua postingan
Tampilkan postingan dengan label javascript. Tampilkan semua postingan

Sabtu, 10 Maret 2012



Recently I came to know that many people are still manually creating the querystring parameters while creating jquery code for posting the form using ajax method of jquery.

For example, if a form has two input elements with ids username and email the querystring will be prepared as below,
var username=$('#username').attr('value');
var email=$('#email').attr('value');

var dataString = 'username='+ username + '&email=' + email;

$.ajax({
type: "POST",
url: "ajaxprocess.php",
data: dataString


});
We should spend lot of time in creating the dataString value if the form has lot of elements.
But actually we need not prepare this dataString value by typing the names of each and every form elements.

We can just use the serialize method of jquery to collect all the form elements with their name and value and to arrange them in the required format.

var dataString =$("#formid").serialize();

Note that serialize() will codify the special characters. i-e If your email field value is info@qualitypointtech.net, it will convert it into info%40qualitypointtech.net

We need to use the urlDecode method of php to decode these converted characters.

If you are not familiar with jquery, you have to first read this jquery forum.

You can subscribe to our Email posts, and you can bookmark this blog for further reading, or you can subscribe to our blog feed.

Sabtu, 11 Februari 2012

Recently I came to know that there were small issues in our Keyword Position Finding Script.

It showed error message when pressing Enter key instead of clicking the submit button after specifying keywords and URL .

This error occurred as  the Form is having more than one submit button (one more uploading csv file, one for submitting the keyword details).
I solved the issue by disabling the pressing of Enter key by adding below piece of code.

function checkEnter(e){
 e = e || event;
 return (e.keyCode || event.which || event.charCode || 0) !== 13;
}
I called this function as "onkeypress="return checkEnter(event)"" from onkeypress event of the Input text box which is used to get URL.

And, I had to add curl_setopt($ch,CURLOPT_HTTPHEADER,array ("Accept: text/plain")); in the cURL function for emulating the Javascript disabling activity.

Right now, our Keyword Rank checking Tool is added with many features. But still I am keeping the same price. If you are interested, you can buy this script from here.

You can subscribe to our Email posts, and you can bookmark this blog for further reading, or you can subscribe to our blog feed.