Asked Questions

I think my question is a little bit more complicated than what I saw on the internet because I need to make multiple filtrations on a single table. So here\'s my code:

 

Views
13
Answers
0

I have Restful API service in asp.net, which provides code for JavaScript to use, i need to use its functions in angular. I am posting code here which has RestAPI function and it includes calls to data and it should return JSON data to calling function i believe. please if anybody familiar with the solution your response will be highly appreciated. Thank-you.

function RestAPI(){ self = this; }
RestAPI.prototype = {
    self: null,
    urlString: \"http://exclusiveautosales.azurewebsites.net/ExclusiveAutoSales_Handler.ashx\",
    GetFiltersMain:function(successFunction,failFunction,token) {
        var data = { \'interface\': \'RestAPI\', \'method\': \'GetFiltersMain\', \'parameters\': {}, \'token\': token };
        var jsonData = dojo.toJson(data);
        var xhrArgs = {
            url: self.urlString,
            handleAs: \'json\',
            postData: jsonData,
            load: successFunction,
            error: failFunction };
        var deferred = dojo.xhrPost(xhrArgs);
    },
    GetMakeModelPrice:function(make_id,model_id,min_price,max_price,successFunction,failFunction,token) {
        var data = { \'interface\': \'RestAPI\', \'method\': \'GetMakeModelPrice\', \'parameters\': {\'make_id\':make_id,\'model_id\':model_id,\'min_price\':min_price,\'max_price\':max_price}, \'token\': token };

        var jsonData = dojo.toJson(data);
        var xhrArgs = {
            url: self.urlString,
            handleAs: \'json\',
            postData: jsonData,
            load: successFunction,
            error: failFunction };
        var deferred = dojo.xhrPost(xhrArgs);
    },
    GetSearchResult:function(search_q,make_id,model_id,year_id,engine_id,color_id,body_id,transmission_id,fueltype_id,subfeature_id,minPrice,maxPrice,successFunction,failFunction,token) 
Views
8
Answers
0
Views
7
Answers
0

I have a function where I check my two (or one) input fileds if they are empty i want to let\'s say print alert in window but if they have vaules i want to run else but in my case alert is not popping up and if i want to submit those two fileds with data it is ok pushing it and doing alll stuff in else but whole browser is reloading. I was trying to add prevent.Default() but not working. Or return false

UPDATE: I made some changes and know when input is empty alert is popping up, but when i colse it it is still realoding whole page, same thing if else is executed all browser is reloading

 let pushBtn = document.getElementById(\'push-btn\');

pushBtn.addEventListener(\'click\', pushData);


 function pushData() {

let deviceVal = document.getElementById(\'device\').value;
let powerVal = document.getElementById(\'power\').value;

if (deviceVal != \'\' || powerVal != \'\') {
    let list = document.getElementById(\'list-group\')
    let button = document.createElement(\'button\');
    let ul = document.createElement(\'ul\');
    let liFirst = document.createElement(\'li\');
    let liSecond = document.createElement(\'li\');
    let liThird = document.createElement(\'li\');

    button.classList.add(\"list-group-item\");
    ul.classList.add(\"desc\");
    liFirst.classList.add(\"t-desc\");
    liSecond.classList.add(\"t-desc2\");
    liThird.classList.add(\"t-desc3\");
    liFirst.textContent = deviceVal;
    liSecond.textContent = powerVal;
    liThird.innerHTML = `<label class=\"switch\">
        <input type=\"checkbox\">
        <span class=\"slider round\"></span>
      </label>`
    modal.style.display = \'none\';
    ul.append(liFirst);
    ul.append(liSecond);
    ul.append(liThird);
    button.append(ul);

    list.prepend(button);



} else {
    alert(\'aaa\');
    return false

}

}

Views
7
Answers
0
Views
13
Answers
0
Views
14
Answers
0
Views
22
Answers
0
Views
12
Answers
0
Views
9
Answers
0

I have a webpack file shown at the bottom of this question. I\'m trying to include a config file \'as is\', with no processing, and the suggested way to do it was through using CommonsChunkPlugin, which I\'ve implemented, and it works alright - It generates two files correctly, with one containing the config.js and one containing the rest of the bundle. However, the config.js also includes over 10,000 lines of other code that seems to be related to bundling, XHR requests, and chunking. Why? How can I remove this code from just this route, and not the main bundle? The reason to do this would be to make config.js easily editable.

const webpack = require(\'webpack\');
const path = require(\'path\');
const HtmlWebpackPlugin = require(\'html-webpack-plugin\');
const ExtractTextPlugin = require(\"extract-text-webpack-plugin\");
const BUILD_DIR = path.resolve(__dirname, \'dist\');
const APP_DIR = path.resolve(__dirname, \'src\');

process.traceDeprecation = true;

const config = {
  entry: {
    app: APP_DIR + \'/app.js\',
    config: APP_DIR + \'/config.js\'
  },
  output: {
    path: BUILD_DIR,
    filename: \'bundle.js\',
    publicPath: \'/\'
  },
  module: {
    rules: [
      {
        test: /\\.js$/,
        include: APP_DIR,
        use: {
          loader: \'babel-loader\',
          options: {
            presets: [\'es2015\', \'react\', \"stage-2\"]
          }
        },
      },
      {
        test: /\\.js$/,
        enforce: \'pre\',
        include: APP_DIR,
        use: \'eslint-loader\',
      },
      {
        test: /\\.(woff|woff2)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,
        use: [{
          loader:\'file-loader\',
          options:{limit:10000,mimetype:\'application/font-woff\'}
        }]
      },
      {
        test: /\\.ttf(\\?v=\\d+\\.\\d+\\.\\d+)?$/,
        use: [{
          loader:\'file-loader\',
          options:{limit:10000,mimetype:\'application/octet-stream\'}
        }]
      },
      {
        test: /\\.eot(\\?v=\\d+\\.\\d+\\.\\d+)?$/,
        use: [{
          loader:\'file-loader\'
        }]
      },
      {
        test: /\\.png$/,
        use: [{
          loader:\'file-loader\'
        }]
      },
      {
        test: /\\.svg(\\?v=\\d+\\.\\d+\\.\\d+)?$/
Views
7