vendredi 8 mai 2015

Gives Error no token Id while using stripe in angular js

I have problem while using stripe with angular js.I have Successfully generate the token with Stripe.but when I post that token to the api it gives error:

{"errors":"There is no token with ID tok_160BQoCgr0gFKoypElkitdl6.

Here is My Controller code:

$scope.card =function()
{

    var number = document.getElementById('number').value;
    var expiry = document.getElementById('exp').value;
    var res = expiry.split("/"); 
    var month = res[0];
    var year = res[1];

    var cvv = document.getElementById('cvc').value;




        $scope.stripeCallback = function (code, result) {


            if (result.error) {
                $scope.stripeError = result.error.message;
            } else {
                $scope.stripeToken = result.id;
            }

            var api_token=storageService.get("api_token");
    $scope.orginal.api_token =JSON.parse(api_token);



//var data = {'number':number,'exp-month':month,'exp-year':year,'stripeToken':$scope.stripeToken,'api_token':$scope.orginal.api_token};
    var data = 'number='+number+'&exp-month='+month+'&exp-year='+year+'&stripeToken='+$scope.stripeToken+'&api_token='+$scope.orginal.api_token;

    console.log(data);

    HomeOwners.NewCard(data).then(function(response){

            console.log(response);



        })  
    };

Here is My service:

NewCard:function(data){

           var Url = baseurl+'card/create';

           var defer = $q.defer();

           $http.post(Url,data).
              success(function (data, status, headers, config) {
                  defer.resolve(data);
              }).
              error(function (data, status, headers, config) {
                  defer.reject();
              });

            return defer.promise;
    },

Please help

CKEditor setData() changes content but throws error

I have the following text area defined in my JSP page:

<textarea id="edit_subtaskstep_notes" name="edit_subtaskstep_notes" rows="15" cols="50"></textarea>

In my js file I am setting the content data as such:

CKEDITOR.instances.edit_subtaskstep_notes.setData("Hello World");

This successfully sets the ckeditor text box to contain "Hello World" when run but after this line is executed the following error is thrown in my output window:

Uncaught TypeError: undefined is not a function (14:21:03:488 | error, javascript)
at (anonymous function) (:197:29)

If I remove that line the error goes away but the data is no longer set. As it "seems" to work since the data is getting set is this some kind of bug with CKEditor v4? I'm trying to trouble shoot a key event focus bug having to do with Bootstrap modals but need to try and eliminate this one before proceeding.

How to make an accept condition for droppable td to accept only the class within the same row?

I have this droppable td.

$('#ScrumTable td').droppable({
    hoverClass: 'ondrop',
    accept: '.card',
    drop: function(event, ui){
        $(this).append($(ui.draggable));
        ui.draggable.css("top",$(this).css("top"))
        ui.draggable.css("left",$(this).css("left"))
        if(  parseInt( $(this).index() ) + 1 == 1){
            ui.draggable.addClass('backlog-card');
            ui.draggable.removeClass('inprogress-card');
            ui.draggable.removeClass('tovalidate-card');
        }
        else if(  parseInt( $(this).index() ) + 1 == 2){
            ui.draggable.addClass('inprogress-card');
            ui.draggable.removeClass('backlog-card');
            ui.draggable.removeClass('tovalidate-card');
        }
        else if(  parseInt( $(this).index() ) + 1 == 3){
            ui.draggable.addClass('tovalidate-card');
            ui.draggable.removeClass('inprogress-card');
            ui.draggable.removeClass('backlog-card');
        }
    }
});

The droppable td above must only accept the class that is within the same row. What condition can I put to the accept attribute of the droppable td?

jquery post call not working with slash at end of the url

example url:
Target is not to show .php extension, but content stop working when page/url is open with a slash at the end.
http://ift.tt/1F9Oyt6 - form is working with this url
http://ift.tt/1EnOLSI - form is not working with this url

Folder & files:
|
| /js/custom.js
| /manager/create.php
| /manager/creategetpostdata.php
| /manager/.htaccess

Content on custom.js

$(window).load(function() {
    // get post code data
    $('.contentfinder').on('keyup', function(e){
        var xyz = $(this).closest('.contentRow');
        //alert( "success" );
        $.post("../manager/creategetpostdata.php", xyz.find('.contentfinder').serialize(),  function(response) {
            //alert( "success" );
            xyz.children('.showPostData').html(response);
            xyz.children('.showPostData').show();
        });

    });

});

input form on create.php file:

                    <div class="contentRow">
                        <input type="text" name="inputdata" class="form-control contentfinder" placeholder="" />
                        <div class="showPostData"></div>
                    </div>

content on creategetpostdata.php

<?php echo 'hello, what the hell wrong with you. just show content now!'; ?>

content on .htaccess file

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\?([^=]+)=([^\s&]+) [NC]
RewriteRule ^ /%1/%2/%3? [R=302,L,NE]

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\s [NC]
RewriteRule ^ /%1 [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

any help? thanks in advance.

knockout-postbox and knockout components can you syncWith observable arrays?

I have two components that I want to sync an observable array between them. It works find with an observable, but with an array it never syncs. Can you syncWith an observable array?

If I convert the array to string and then sync the observable it passes, but then I have to reconstruct the observable array on the other vm. Can it be done with just a syncWith?

vm1

  self.offers = ko.observableArray([]).syncWith("offersLink");


            var mappedLogs = $.map(allData, function (item) { return new model.offerList(item) });
            self.offers(mappedLogs);

vm2

 self.offers = ko.observableArray([]).syncWith("offersLink");

json data that have location ,date, (lunch/ dinner) and meal value that changes on every order . plz tell me how to convert this into html table

cart:{   
      Gurgaon_2015-5-6_Lunch_-Meal42:{  
                                      chefMobile:"9268211346",
                                      chefName:"Vijaya",
                                      path:"-JmtUcV4v9k50dlO9n41/Gurgaon/2015-5-6/Lunch",
                                      price:200,
                                      quantity:1,
                                      stock:8,
                                      timeslot:1430901000000
                                     }
}

Uncaught ReferenceError: RSVP is not defined , error while using require.js with rsvp

I am working on a demo showing the error handling in promises using rsvp.js. Everything seemed fine, till I used the CDN url for rsvp.js in a tag. Now since I have require.js for module loading in my application, I tried loading the rsvp.js module via require js syntax. In the Chrome network tab, I see the rsvp.js module getting loaded properly as well, but I get the below error in console,

Uncaught ReferenceError: RSVP is not defined.

require(["bootstrap","js/rsvp"], function(bootstrap,rsvp) { 
$(document).ready(function () {
    function getEmployeeDetails() {
        var radioValue1 = $("input[name='option1']:checked").val();
        var requrl;
        if (radioValue1 == "fail") {
            requrl = "../../../testservice/getEmployeeIdss";
        } else {
            requrl = "../../../testservice/getEmployeeId";
        }
        return new RSVP.Promise(function (resolve, reject) {
            $.ajax({
                url: requrl,
                success: function (response) {
                    try {
                        $('#successBoard').append("<b> <i> Ajax Call 1 Succeeded! </i>  </b><br/>" + "Employee ID:" + response.stuId + "<br/>");
                        resolve(response.stuId);
                    } catch (e) {
                        reject(e);
                    }
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    console.log('Ajax 1 failed : Rejecting Promise 1');
                    $('#errorBoard').append("<b> <i> Ajax 1 failed : Rejecting Promise 1</i>  </b><br/>");
                    reject(thrownError);
                }
            });

        });
    }