Tuesday, August 26, 2014

arrange the numbers in input name element array after remove one of it by js

I want after add a input and remove it, arrange the numbers in input name element array by jQuery but don't work for me after remove input. How can fix it?

Answer


I guess that you want to re-number the inputs after a remove, so that the array is made of contiguous numbers.
I have rewritten some things, among which the renumbering function, using an index contextual to the parent function.
function removeidx(context, clss, type) {
    var remove = $(context).closest(clss);
    remove.fadeOut('slow', function () {
        $(this).remove();
        var idx = 0;
        $(clss).each(function () {
            var checkBoxes = $('input[type="' + type + '"]', this);
            checkBoxes.each(function () {
                var name = $(this).attr('name');
                name = name.replace(/\d+/, idx);
                $(this).attr('name', name);
                idx = idx + 1;
            });
        });
    });
}

$(document).on('click change', 'a.adding', function (e) {
    e.preventDefault();
    var idx = $('.Row').length;
    $('.ffdd').append('<div class="Row"> <input name="arr[' + idx + '][]" type="text" value=""> <a href="#" class="remove_row" title="remove this row">Remove</a></div>');
});

$('.ffdd').on('click', 'a', function (e) {
    removeidx(this, '.Row', 'text');
})
You can see a working version there : http://jsfiddle.net/8sVWp/

ref 
http://stackoverflow.com/questions/14600150/arrange-the-numbers-in-input-name-element-array-after-remove-one-of-it-by-js

Sunday, August 24, 2014

Service Temporarily Unavailable Magento?

My Application was working fine yesterday. I started my Pc today when I tried to start magento I Got This Error message.
Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime
or capacity problems. Please try again later.
I am not able to Open even admin page and I am not even able to see any sort of errors on then page. if i give any url of my magento site I am getting the above output. How do I resolve this? Please Help...


Answer


Check if there is a file called maintenance.flag in your magento root. If so Delete it.
When Magento is performing certain tasks it temporarily creates this file. Magento checks for its existence and if it's there will send users to the page you described.
It's supposed to automatically delete this file when done processing whatever task it was doing, but I've experienced occasions where something went wrong and it failed to delete it.

ref:
http://stackoverflow.com/questions/8102777/service-temporarily-unavailable-magento

Monday, August 11, 2014

Make a div disappear or appear after few seconds with jQuery

You must have seen this effect when a particular element is visible for few seconds and then it fades out. Such things are used for notifications. You can also implement the same in your web application with jQuery. It is really very simple.

Find below jQuery code to show the div for 3 seconds and after that it fades out automatically. Use setTimeout() function to achieve this.

ref :http://www.jquerybyexample.net/2012/12/make-div-disappear-or-appear-after-few-seconds-jquery.html

Also Read:

$(document).ready(function() {
2    setTimeout(function() {
3        $(".content").fadeOut(1500);
4    },3000);
5});



 

MS in Computer Science with paid training in USA company