Use jQuery for performin POST or GET request from your html page like this :
function fun() { var data="hello"; $.get("http://localhost/ws/service.asmx/HelloWord", function(response) { data = response; }).error(function(){ alert("Sorry could not proceed"); }); return data; }
OR :
function fun() { var data="hello"; $.post('http://localhost/ws/service.asmx/HelloWord',{},function(response) { data = response; }).error(function(){ alert("Sorry could not proceed"); }); return data; }
Related Posts:
- How do I link a JavaScript file to a HTML file?
- JavaScript runtime error: ‘$’ is undefined
- JavaScript Loading Screen while page loads
- How to make a simple image upload using Javascript/HTML
- Javascript – ERR_CONTENT_LENGTH_MISMATCH
- jQuery UI Datepicker not working
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Getting click on item to open closest relevant element (popup) with jQuery
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Site images are fixed in front of my site content [closed]
- How do I check whether a checkbox is checked in jQuery?
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Check if checkbox is checked with jQuery
- How can I get the data-id attribute?
- My javascript is returning this error: $.ajax is not a function
- How to read xml file contents in jQuery and display in html elements?
- Rotate image with javascript
- How can I select an element by name with jQuery?
- jQuery disable/enable submit button
- How to make Bootstrap carousel slider use mobile left/right swipe
- Display XML content in HTML page
- Play/pause HTML 5 video using JQuery
- javascript function wait until another function to finish
- Refresh/reload the content in Div using jquery/ajax
- jQueryUI dialog width
- SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
- Clear form fields with jQuery
- How to scroll an HTML page to a given anchor
- How do I refresh a DIV content?
- The ‘describe’ keyword in javascript
- jQuery sort elements using data id
- $(document).ready(function() is not working
- Closing Bootstrap modal onclick
- Move WordPress native javascript to bottom of page?
- Ajax call does not activate callback function
- Trying to get single posts to load on the front page via ajax
- Ajax not firing properly using Firefox, but works in Chrome
- Nice scroll to wordpress
- jQuery Hoverintent plugin in TwentyEleven Menu [closed]
- How wp_enqueue_script works?
- Script won’t execute in the media manager
- Gravity Forms not loading under https, jQuery is not defined
- wp_ajax unauthenticated and authenticated
- WordPress ajax function parameter value not being passed
- Is it safe to include a javascript file in a template’s php file?
- Add a Fancybox automatically to post type “post” images
- Enqueuing javascript files
- WordPress customizer refresh screen after save
- Show post in slider
- Creating multiple enclosing shortcodes and fixing JS issues on click
- Can’t load a class into WordPress post editor’s content field
- JSON output returns page source code [closed]
- Dealing with a library that depends on jQuery
- start.js:45TypeError: Not enough arguments on Safari [closed]
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- I want to import my Json file into a custom made display-modal. How do i link my Json file?
- Help with a jQuery Carousel
- Searching multiple tags and adding jQuery dependant script onto page template?
- TinyMCE 4 remove/add attributes for all images
- Fall Back Google CDN in JavaScript
- Adding a slide toggle on WordPress
- I have an old version of jQuery showing up. How do I figure out where it is coming from?
- Loading scripts on a single page plants the script in the footer
- Search input area autogrow – how?
- Get value of selected option in select field in a WordPress form
- Required radio button does not validate in form, when clicked through Javascript/jQuery
- Blur.js with WordPress – Enqueued, but server not finding file
- Replacing WordPress Icons (menu,icons32, etc)?
- Screen Options JavaScript Code
- Is there some jQuery conflict here?
- Theme has superfish – how to add supersubs?
- Best way to add some custom javascript using jquery to a child theme
- JQuery script working locally on desktop, not working on WordPress + Divi
- How to use wp_ajax_set_post_thumbnail?
- Add JQuery As Code Snippet
- Form validation before submitting
- How can publish my bootstrap created table ( huge amount of data) on my word-press theme?
- JQuery toggle in Visual Composer
- jQuery not working for media uploader
- How to toggle custom WP archive list
- WP Media Uploader modal conflicts with Bootstrap modal
- JQuery Login Dropdown not functioning in theme
- Javascript function to switch out images
- Enqueue javascript that inserts custom php widget into jQuery-constructed div
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Uncaught TypeError: undefined is not a function (shortcode-box)
- Running javascript in a child theme. Works in jsfiddle
- How to block action if post is “dirty”?
- WordPress video end function [duplicate]
- wp_register_script Question
- Ensure an external javascript file called from plugin is loaded after jquery is called
- Why my vertical tab js code is refreshing the page continuously? [closed]
- bootstrap-slider.js by seiyria not working in wordpress
- Individual Pages are loading halfway down
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- shortcode execution when the page is opened
- Sending jQuery variable to php function
- Contact Form 7 – Submit Form not working After Ajax Request [closed]