Calling a WCF service with jquery ajax from Sharepoint Online

I've used these codes to call an application installed on the client and configured to listen to a port on the local host, from a page containing a form published in Sharepoint Online.
In this case, I had to assign "http: // localhost: xxxx" to call_UrlEndpoint, but instead try to put your intranet URL.

openLocalApp function (call_UrlEndpoint, dataJson) {
$ .ajax ({
url: call_UrlEndpoint,
type: "POST",
async: true,
data: JSON.stringify (dataJson),
jsonp: "reminder",
jsonpCallback: "save",
contentType: 'application / json',
processData: false,
crossDomain: true,
dataType: & quot; jsonp & # 39;
success: function (answer) {
alert ("success");
}
error: function (answer) {
alert ("The scan component failed!");
}
});

}

How to get value from a check box in jquery that is in a column using .map .find

How to get value from a check box in jQuery that is in a column using .map .find. I'm using this code and it does not concatenate the value of the check box.

                                                                var cols_id_servico = $ (& col_id_servico & # 39;)
.closest ("tr")
.map (function () {
returns $ (this) .find ("input: eq (0)") val () + "/" +
$ (this) .find ("input: eq (2)"). val () + "/" +
$ (this) .find ("input: eq (3)"). val () + "/" +
$ (this) .find ("input[type='checkbox']: checked: eq (4) ") length> 0?" Yes No ";
})
.toArray ()
.join (& # 39;);
alert (cols_id_servico);

javascript – Jquery text () does not want to work with append ();

for (ie i = 0; i <json.length; i ++) {
let color = $ ("td # color" + i) .text ();
let's say img = & # 39; img / & 39;
$ ("td # color" + i) .text (& # 39;). append (``);
}; 

The code must traverse the tds of the table and change the text to "black," "white," and so on. in images by retrieving the text data with text () and adding them to the td with a unique identifier. But in reality, it only shows the last color (with an image), but all the previous ones are erased.

$ .getJSON ("https://rawgit.com/Varinetz/e6cbadec972e76a340c41a65fcc2a6b3/raw/90191826a3bac2ff0761040ed1d95c59f14eaf26/frontend_test_table_table.json", function (json) {

$ (# Table-cars & # 39;). append ("");
for (let counter = 0; counter <json.length; counter ++) {
$ (# Table-cars & # 39;). append (""+ json[counter].title + "
"+""+ json[counter].description + ""+"" + ""+ json[counter].year + "" + ""+ json[counter].color + "" + ""+ json[counter].status + "" + ""+ json[counter].price + "руб." + "" + ""+""+""); // REPLACING TEXT IN COLOR // Code valid, but does not work. I do not know why // If you can, give me a hint. // The culprit is the variable "color". // Only the green color works. If you change it, everything works as expected. for (ie i = 0; i <json.length; i ++) { let color = $ ("td # color" + i) .text (); let's say img = & # 39; img / & 39; $ ("td # color" + i) .text (& # 39;). append (``); }; // ugly code that works right away // const img = & # 39; img / & 39; // $ ("td # color0"). html (``); // $ ("td # color1"). html (``); // $ ("td # color2"). html (``); // $ ("td # color3"). html (``); // $ ("td # color4"). html (``); // STATUS TEXT REPLACEMENT

Название Год Вет Статус Цена

jquery – Tips Needed to Optimize JavaScript For Loop

$ (& # 39; table__button & # 39;). click (function () {
for (var i = 0; i <$ (& # 39; table.table td). length; i ++) {
if (! $ ($ (& # 39; table.table td & # 39;)[i]) .hasClass (_cell table - disabled)) {
$ ($ (& # 39; table.table td & # 39;)[i]) .css (& # 39; background, $ ($ (& # 39; table.table td & # 39;)[i]) .attr ('data-color');
$ ($ (& # 39; table.table td & # 39;)[i]) .css (& # 39; text-decoration & # 39 ;, & quot; Underlined & quot;);
$ ($ (& # 39; table.table td & # 39;)[i]) .css (& # 39; font-weight & # 39 ;, & quot; bold & # 39;);
$ ($ (& # 39; table.table td & # 39;)[i]) .css (& # 39; text-align & # 39; & # 39; center & # 39;);
$ ($ (& # 39; table.table td & # 39;)[i]) .addClass (& dquo; - colored & # 39;);
$ ($ (& # 39; table.table td & # 39;)[i]) .html (& # 39; I am now & # 39; + $ ($ (& # 39; table.table td & # 39;)[i]) .attr ('data-color');
}
$ (& # 39; table__button & # 39;). attr (& # 39; disabled & # 39; & # 39; disabled & # 39;);
}
});
/ * do not change the css * /

table {
width: 100%;
lower margin: 40 px;
}
tr: nth child (odd) {
background: # f0f0f0;
}
td {
upholstery: 10px;
}

 
Make me green Make me yellow
Make me blue Make me red
Leave me alone Leave me alone

javascript – Validation using the Jquery Steps plugin

                    if (newIndex === 2 && $ ("# street"). val () == "") {
returns false;
}

$ (document) .ready (function () {

$ ("# assistant"). steps ({

headerTag: "h2",
bodyTag: "section",
transitionEffect: "slideLeft",
stepsOrientation: "vertical",
labels: {
current: "step current:",
pagination: "pagination",
finish: "Finish",
next: "Confirm",
previous: "Back",
loading: "Loading ..."
}
onStepChanging: function (event, currentIndex, newIndex, cepError) {
if (currentIndex> newIndex) {
return true;
}

if (newIndex === 1) {
return true;
}

if (newIndex === 2 && $ ("# street"). val () == "") {

returns false;
}

}
}

)
});
        
     

Request for verification

command:

Place of delivery

Payment method

Enter your payment method:

  • How to set the content in the wysiwyg editor with the help of JQuery in magento2?

    I have a wysiwyg custom form admin editor created with the help of a UI component.

    I want to define the content with the help of JQuery in magento2

    Can any one help me?

                    to define([
            'underscore',
            'uiRegistry',
            'Magento_Ui/js/form/element/select',
            'mage/url',
            'wysiwygAdapter'
        ], function (_, uiRegistry, select, url, tinyMCE) {
    & # 39; use strict & # 39 ;;
    returns select.extend ({
    
    initialize: function () {
    var obj = this;
    var type = this._super (). initialValue;
    this.makevisilibily (type);
    
    var defaultTemplate = uiRegistry.get (& # 39; banner_form.areas.general.general.default_template & # 39;);
    
    defaultTemplate.on (& # 39; update & # 39; function () {
    obj.displayTemplateImage (defaultTemplate.value ());
    })
    
    jQuery (& # 39; body & # 39;). on ('click', '# banner_load_template_btn', function () {
    var toggleMCEEditor = jQuery (#gglebanner_form_content);
    var defaultTemplate = uiRegistry.get (& # 39; banner_form.areas.general.general.default_template & # 39;);
    var templateContent = obj.displayTemplateContent (defaultTemplate.value ());
    
    toggleMCEEditor.trigger ('click');
    
    tinyMCE.get (# textarea # banner_form_content & # 39;). setContent (templateContent);
    })
    return this;
    
    }
    
    / **
    * On the change manager.
    *
    * @param {String} value
    * /
    onUpdate: function (value) {
    this.makevisilibily (value);
    var defaultTemplate = uiRegistry.get (& # 39; banner_form.areas.general.general.default_template & # 39;);
    
    this.displayTemplateImage (defaultTemplate.value ());
    return this._super ();
    }
    
    makevisilibily: function (value) {
    
    var field1 = uiRegistry.get (& # 39; banner_form.areas.general.general.default_template & # 39;);
    var field2 = uiRegistry.get (& # 39; banner_form.areas.general.general.default_image & # 39;);
    var field3 = jQuery (& # 39; body & # 39; find (& # 39 ;. bannerwysiwygClass & # 39;);
    var field4 = jQuery (& # 39; body & # 39;). find (". bannerimageClass");
    
    if (value == 1) {
    field1.visible (true);
    field2.visible (true);
    field3.show ();
    field4.hide ();
    } other {
    field1.visible (false);
    field2.visible (false);
    field3.hide ();
    field4.show ();
    }
    
    return this._super ();
    }
    displayTemplateImage: function (defaultTemplate) {
    var data = this.getContentAndImage (defaultTemplate);
    jQuery ("# ​​mp-demo-image"). attr ("src", data['imgSrc'])
    
    }
    
    displayTemplateContent: function (defaultTemplate) {
    var data = this.getContentAndImage (defaultTemplate);
    return data['templateContent'];
    
    }
    
    
    getContentAndImage: function (defaultTemplate) {
    var imgSrc = "http://magento.stackexchange.com/";
    var templateContent = "http://magento.stackexchange.com/";
    var data =[];
    if (defaultTemplate == "demo1.png")
    {
    imgSrc = window.defaultTemplate1;
    templateContent = window.defaultContent1;
    }
    else if (defaultTemplate == "demo2.png")
    {
    imgSrc = window.defaultTemplate2;
    templateContent = window.defaultContent2;
    }
    else if (defaultTemplate == "demo3.png")
    {
    imgSrc = window.defaultTemplate3;
    templateContent = window.defaultContent3;
    }
    else if (defaultTemplate == "demo4.jpg")
    {
    imgSrc = window.defaultTemplate4;
    templateContent = window.defaultContent4;
    }
    else if (defaultTemplate == "demo5.jpg")
    {
    imgSrc = window.defaultTemplate5;
    templateContent = window.defaultContent5;
    }
    The data['imgSrc'] = imgSrc;
    The data['templateContent'] = templateContent;
    return data;
    }
    });
    });
    

    javascript – I have problems with scrolling in JQuery

    Hello, I use the scroll function present in the document JQuery, everything goes well, at least as long as I'm in the component with the href to scroll, but when I leave this component, the following error is displayed each time. a parchment: ERROR TypeError: Unable to read property & top; d & # 39; undefined

    Navbar component

    NavbarComponent export class implements OnInit {
    
    // navigation bar
    opacityNavbar: number = 0;
    
    constructor () {}
    
    ngOnInit () {
    this.animateScrolling ();
    this.activeOpacityNavbar ();
    this.activeNavbar ();
    }
    
    onNavbar () {
    $ (& # 39; navbar-collapse & # 39;). collapse (& # 39; toggle & # 39;)
    }
    
    animateScrolling () {
    $ ("a"). one ('click', function () {
    leave select = $ (this) .attr ("href");
    letAux = $ (select) .offset (). top;
    leave position: number;
    if (select == "#home") {
    position = 0;
    } else if (select == "#about") {
    position = positionAux - 73;
    } else if (select == "#services") {
    position = positionAux + 127;
    } else if (select == "#contact") {
    position = positionAux - 43;
    }
    $ ("html, body"). animate ({scrollTop: position}, 600)
    });
    }
    
    activeNavbar () {
    $ (document) .scroll (function () {
    var opacityNavbar = $ (this) .scrollTop ();
    if (opacityNavbar> = ($ ("# home")) offset (). top) && opacityNavbar < ($("#about").offset().top) - 73) {
            $(".home-nav").addClass("active");
            $(".about-nav").removeClass("active");
            $(".services-nav").removeClass("active");
            $(".contact-nav").removeClass("active");
          } else if (opacityNavbar >= ($ ("# about") offset (). top - 80 && opacityNavbar < ($("#services").offset().top) + 127) {
            $(".home-nav").removeClass("active");
            $(".about-nav").addClass("active");
            $(".services-nav").removeClass("active");
            $(".contact-nav").removeClass("active");
          } else if (opacityNavbar > ($ ("# services") offset (). top) + 126 && opacityNavbar < ($("#contact").offset().top) - 44) {
            $(".home-nav").removeClass("active");
            $(".about-nav").removeClass("active");
            $(".services-nav").addClass("active");
            $(".contact-nav").removeClass("active");
          } else if (opacityNavbar >= ($ ("# contact") offset () up) - 43)
    $ (".home-nav"). removeClass ("active");
    $ ("about-nav"). removeClass ("active");
    $ (".services-nav"). removeClass ("active");
    $ ("contact-nav"). addClass ("active");
    }
    });
    }
    
    activeOpacityNavbar () {
    $ (document) .scroll (function () {
    var opacityNavbar = $ (this) .scrollTop ();
    if (opacityNavbar> ($ ("# about") offset (). top) - 40) {
    $ (". navbar"). addClass ("opacity-navbar");
    } else {
    $ (". navbar"). removeClass ("opacity-navbar");
    }
    });
    }
    }
    

    Component Sections for Scrolling

    
    
    

    Component that is not part of the sections and where I get the error





    BE WELCOME
    AT THE ADMINISTRATIVE PANEL








    Routes (app-routing.module.ts)

    const roads: Roads = [
      {
        path: '',
        component: MainComponent
      }, {
        path: 'login',
        component: LoginComponent
      }, {
        path: 'access-denied',
        component: GuardsErrorComponent
      }, {
        path: 'admin',
        component: AdminMainComponent,
        canActivate: [GuardsService],
    the children: [
          { path: '', redirectTo: 'home', pathMatch: 'full' }, {
            path: 'home',
            component: AdminHomeComponent,
            canActivate: [GuardsService]
          }, {
    way: & # 39;
    component: AdminAboutComponent,
    canActivate: [GuardsService]
          }, {
    path: "posts",
    component: AdminProjectsComponent,
    canActivate: [GuardsService]
          }
    ]}
    {path: "home", redirectTo: "pathMatch:" & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;,
    {path: & # 39 ;, redirectTo: & # 39; & # 39;; pathMatch: & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;}
    {path: 'services', redirectTo:', pathMatch: 'full',
    {path: 'contact', redirectTo: ', pathMatch:' full ',
    {path: "###, component: NotFoundComponent},
    ];
    
    @NgModule ({
    imports: [RouterModule.forRoot(routes, { useHash: true })],
    exports: [RouterModule]
    })
    
    AppRoutingModule {} export class
    

    javascript – Problem when counting equal values ​​in jQuery DataTable

    Good night

    I have a table and I try to filter equal values ​​in the rows, but without success. Code to filter (returns the record number that corresponds to the total number of records);

                                                    var filterData = table.column (4) .data (). filter (function (value, index) {
    return value = "New York"? right wrong;
    })
    console.log (filterData.count ());
    $ (". sum"). html (filterData.count ());
    
    
    Board:
    
    var table = "";
    table = $ (.table) .DataTable ();
    

    Board:

            
    Name Position Office Age City Salary
    Tiger Nixon System Architect Edinburgh 61 New York 320,800
    Garrett Winters Accounting Tokyo 63 New York 170,750
    Ashton Cox Junior Technical Writer San Francisco 66 New York 86,000
    Cedric Kelly Senior Javascript Developer Edinburgh 22 New York 433,060
    Airi Satou Accounting Tokyo 33 New York 162,700
    Brielle Williamson Integration Specialist New York 61 New York 372,000
    Herrod Chandler Commercial assistant San Francisco 59 New York 137,500
    Rhona Davidson Integration Specialist Tokyo 55 New York 327,900

    jquery – How to use WEBSOCKET in a PHP MYSQL discussion

    Good night, I started looking and I want to work with websocket to update in real time a chat that I have in my code, but I did not understand the right websocket to do the implementation , if anyone can help me, thanks … I have this part of the code that sends the message to another user:

    right-col.php

          0) {
    while ($ row = mysqli_fetch_assoc ($ r)) {
    $ sender_name = $ row['sender_name'] ;
    $ reciever_name = $ row['reciever_name'] ;
    
    if ($ _SESSION['login'] == $ sender_name) {
    $ _GET['user'] = $ reciever_name;
    } else {
    $ _GET['user'] = $ sender_name;
    }
    }
    } else {
    // this user has not sent any messages
    echo "There is no message for you";
    $ no_message = true;
    }
    } else {
    // query problem
    $ q;
    }
    
    }
    
    if ($ no_message == false) {
    $ q = "SELECT * FROM messages WHERE
    sender_name = "#. $ _ SESSION ['login']""
    AND reciever_name = "#. $ _ GET ['user']""
    OR
    sender_name = "#. $ _ GET ['user']""
    AND reciever_name = "#. $ _ SESSION ['login']. "& # 39;";
    
    $ r = mysqli_query ($ con, $ q);
    
    if ($ r) {
    // request seccessfull
    while ($ row = mysqli_fetch_assoc ($ r)) {
    $ sender_name = $ row['sender_name'] ;
    $ reciever_name = $ row['reciever_name'] ;
    $ message = $ row['message_text'] ;
    
    // check who is the sender of the message
    if ($ sender_name == $ _SESSION['login']) {
    // display the message with the gray back
    ?>
    
                    
    Me:

    envoi_processus.php

    
    
                    
    Me:

    I found this excerpt using the websocket, I tried to implement it in mine, but it did not work.

    application.js